videojs-youtube icon indicating copy to clipboard operation
videojs-youtube copied to clipboard

How to play hls video

Open vanminhquangtri opened this issue 10 months ago • 4 comments

Hello, I have read the docs but the no guidance for play hls video, such is file m3u8. My website provide line channel stream as well as movies. My video url is same format with: https://some.domain/index.m3u8

Can you please give me an example how to run this? Thank you.

vanminhquangtri avatar Sep 16 '23 11:09 vanminhquangtri

I see this website use video-youtube for hls vod. But don't know how they do https://pops.vn/video/cam-y-chi-ha-tap-1-61721faa70b7b600556dfb4e

vanminhquangtri avatar Sep 18 '23 03:09 vanminhquangtri

The videojs-youtbe tech is not used for HLS. The default build of Video.js includes HLS support. Just load a source specifying the type,

<source src="video/test.m3u8" type="application/x-mpegURL">

or

player.src({
  src: 'https://example.com/video.m3u8',
  type: 'applicaiton/x-mpegURL'
});

mister-ben avatar Sep 18 '23 16:09 mister-ben

@mister-ben thank you for your email. Yes I know with Videojs we can run hls. My main purpose is to make my hls video auto play without unmuted. Like the below webite do. https://pops.vn/video/cam-y-chi-ha-tap-1-61721faa70b7b600556dfb4e

As you can see, they use library videojs-youtube. They auto play video unmuted. I am trying to do this but not success.

vanminhquangtri avatar Sep 19 '23 09:09 vanminhquangtri

I can't see what's happening on that website die to its geo restrictions, but there is no trickery in videojs-youtube to workaround autoplay restrictions, and having the videojs-youtube tech present when a non-Youtube source is used will do nothing. On Chrome, autoplay with sound is allowed if the user's Media Engagement Index for the website is above a threshold, so your experience might not be the same as others.

mister-ben avatar Sep 19 '23 21:09 mister-ben