silvermine / videojs-chromecast

MIT License
147 stars 74 forks source link

Not working file m3u8 in chromecast #163

Open su-su-nhh opened 1 year ago

su-su-nhh commented 1 year ago

I use file: https://kor.hanvid.com/file/045156a11886e576169f8721d9a61644/playlist.m3u8 to add chromecast but it doesn't work with this file

kontrollanten commented 10 months ago

It should be solved when #118 is released.

nickopris commented 8 months ago

This is supposed to be fixed with the merging of 118 but I could not make it work.

I have a test page here: https://couchtofitness.com/session/407 which does not work as expected. The Chromecast player attempts to load the source for a few seconds then gives up and displays the Chromecast icon. The browser is still connected to Chromecast.

We are loading the plugin from //cdn.jsdelivr.net/npm/@silvermine/videojs-chromecast@1.5.0/dist/silvermine-videojs-chromecast.min.js

The video file link is: https://player.vimeo.com/external/887203408.m3u8?s=e209ffa7f9b282b57843370fc91a55f8b56b14ae

kontrollanten commented 8 months ago

It seems that you haven't configured the modifyLoadRequestFn. It should be configured like this:

options = {
   techOrder: [ 'chromecast', 'html5' ], // Required
   chromecast: {
      modifyLoadRequestFn: function (loadRequest) { // HLS support
         loadRequest.media.hlsSegmentFormat = 'fmp4';
         loadRequest.media.hlsVideoSegmentFormat = 'fmp4';
         return loadRequest;
      }
   },
   plugins: {
      chromecast: {
      },
   }
};
kontrollanten commented 8 months ago

Did it solve your issue?

nickopris commented 8 months ago

I had a version which was casting but the cast button was not showing up in the player. Now I fixed that but it's not casting. I have the same test link https://couchtofitness.com/session/407

I see a blank screen on Chromecast. I'd like to know how to debug this.

dmitriy-baltak commented 8 months ago

Had same issue but probably because of a different problem, hls is packaged not only in .fmp4 but also in .ts and in our case we use ts only, it's probably worth mentioning in the docs this fact, or even think of a more flexible solution that would allow player to support both

nickopris commented 8 months ago

@kontrollanten I still can't get it to work. Can someone post a demo page? I made a simple one here which doesn't work: https://onedesign.ro/videojs/vimeo.html

I just tested my stream url with another player and it seems to be working perfectly with chromecast https://bitmovin.com/demos/stream-test?format=hls&manifest=https%3A%2F%2Fplayer.vimeo.com%2Fexternal%2F887203408.m3u8%3Fs%3De209ffa7f9b282b57843370fc91a55f8b56b14ae

Update: I grabbed the source code and built it locally. I get the same result so I am starting to think that there is something wrong with the way I initialise the player or the stream is different than expected. Here is the test page with the locally built source code: https://onedesign.ro/videojs/locally-built/

nickopris commented 7 months ago

More information from my testing: The link above that was not working is now working: https://couchtofitness.com/session/407 I added a new test link which does not work: https://couchtofitness.com/session/408

They are using the same code, I replaced fmp4 with ts in modifyLoadRequestFn

I struggle to debug the differences between these two feeds. I work with the assumptions that the codec used by Vimeo is the same for both links. The one I can't cast works fine with the Vimeo player so it's definitely possible to fix.

nickopris commented 7 months ago

I managed to get a working version by downloading the 4k version of the video file from Vimeo and re-uploading it. The only thing that I saw different was that the non-working hls url did not have the SUBTITLES entry. After re-uploading the auto-generated captions option was enabled on the Vimeo video settings page and it seems to cast fine.

This bit was in the working feed: #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English (auto-generated)",LANGUAGE="en-x-autogen",URI="https://165vod-adaptive.akamaized.net/exp=1702418400~acl=%2Fe39db795-dd34-4da0-8102-171719e15f24%2F%2A~hmac=90bf07f1c1fab7b4a84b7915063557bf516663b715d72b2eddedfba4b5190282/e39db795-dd34-4da0-8102-171719e15f24/subtitles/119986868/playlist.m3u8?d=41.474767&f=dash&subtoken=5c0019d5d8f74f8e59fd72e3ec0681ecb219d69567543bcb880eb9974ba5ef23",CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog",AUTOSELECT=YES,DEFAULT=NO

kontrollanten commented 4 months ago

@nickopris Sorry for late answer. Can you try the demo at https://github.com/silvermine/videojs-chromecast/pull/166

Do you remember to run player.chromecast() after videojs initilazation?

   videojs('video_1', videojsOptions, function() {
      this.chromecast();
      loadVideo(videos[videoSelector.value]);
   });