Need some help. Video loads in browser but never starts playing. I'm using hls.js to stream m3u8 playlist to the browser. And I use FFmpeg to create ts and m3u8 files.
For FFmpeg :
./ffmpeg -rtsp_transport tcp -i rtsp://user:password@ipaddress/axis-media/media.amp -vcodec copy -hls_time 4 -hls_list_size 4 -hls_wrap 4 -start_number 1 -y test.m3u8
HTML Code:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
</head>
<body>
<video id="video" height="800px" width="1200px"></video>
<body>
<script>
var video = document.getElementById('video');
if(Hls.isSupported()){
var hls = new Hls();
hls.loadSource('/images/live/test.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
else if (video.canPlayType('application/vnd.apple.mpegurl')){
video.src = '/images/live/test.m3u8';
video.addEventListener('loadedmetadata',function() {
video.play();
});
}
</script>
</html>