In database, videos are saved in m3u8 format as shown below. I want to open video when I click on button or download it. I read this. But still not clear for me? Thanks in advance.
dfa7088-9d3c-4b23-0010a-59fc63f4441d/hls/qe8b807916f8816a.m3u8
@if( $item->media_type=='v')
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video" src=" https://cdn.kenan.net/{{ $item->media_path}}" controls width="200px" height="200px"></video>
<script>
if(Hls.isSupported())
{
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('playlist.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function()
{
video.play();
});
}
else if (video.canPlayType('application/vnd.apple.mpegurl'))
{
video.src = 'playlist.m3u8';
video.addEventListener('canplay',function()
{
video.play();
});
}
</script>
@else@endif