silvermine / videojs-chromecast

MIT License
148 stars 75 forks source link

Error casting Fragmented MP4 HLS videos #123

Closed frikiluser closed 1 year ago

frikiluser commented 2 years ago

While DAHS-fMP4 videos can be shared using this plugin HLS-fMP4 can't.

Google Documentation:

https://developers.google.com/cast/docs/reference/web_sender/chrome.cast.media.MediaInfo#hlsSegmentFormat
https://developers.google.com/cast/docs/reference/web_sender/chrome.cast.media.MediaInfo#hlsVideoSegmentFormat

Example URL:

https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8

Working HTML-based player:

https://bitmovin.com/demos/stream-test?format=hls&manifest=https%3A%2F%2Fbitmovin-a.akamaihd.net%2Fcontent%2FMI201109210084_1%2Fm3u8s%2Ff08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8

Thanks for your great work!!

frikiluser commented 2 years ago

Working dirty hack:

diff --git a/src/js/tech/ChromecastTech.js b/src/js/tech/ChromecastTech.js
index cef12a7..a7375d0 100644
--- a/src/js/tech/ChromecastTech.js
+++ b/src/js/tech/ChromecastTech.js
@@ -172,6 +172,10 @@ ChromecastTech = {
          mediaInfo.customData = customData;
       }

+      // FIXME: Dirty hack for demo purposes only!
+      mediaInfo.hlsSegmentFormat = chrome.cast.media.HlsSegmentFormat.FMP4;
+      mediaInfo.hlsVideoSegmentFormat = chrome.cast.media.HlsVideoSegmentFormat.FMP4;
+
       this._ui.updateTitle(title);
       this._ui.updateSubtitle(subtitle);

Of course it can't be done that way. It's just a working demo.

Hope it helps and can be merged someway soon.

kontrollanten commented 2 years ago

Hi! This will be solved by https://github.com/silvermine/videojs-chromecast/pull/118. Then you can use the following videojs options:

{
  chromecast: {
    modifyLoadRequestFn: function (loadRequest) {
      loadRequest.media.hlsSegmentFormat = 'fmp4';
      loadRequest.media.hlsVideoSegmentFormat = 'fmp4';
      return loadRequest;
    }
  }, 
}