코드

hls.js 플레이어 예제

상석하대 2023. 8. 8. 19:56

RTMP 라이브 스트리밍 서버 - Windows 10, 11

구축 후 웹으로 송출하는 경우이다.

<!doctype html>
<html lang="ko">
<head>
<meta charset=utf-8>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video" width="640" autoplay controls></video>
<script>
	if(Hls.isSupported()) {
		var video = document.getElementById('video');
		var hls = new Hls();
		hls.loadSource('http://220.73.161.63:8080/live/relay.m3u8');
		hls.attachMedia(video);
		hls.on(Hls.Events.MANIFEST_PARSED,function() {
			video.play();
		});
	}
</script>
</body>
</html>
반응형