hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Alternative video

Open popler opened this issue 9 years ago • 7 comments

Hi, do you have any plans to add options for alternative video ? It will be very useful, for example during live streaming from sports events. It canbe use to switch to another camera. I found some info at wowza site https://www.wowza.com/docs/how-to-use-alternative-audio-or-video-tracks-with-apple-hls-streams. Please check alternative-video.smil paragraph.

popler avatar Aug 20 '17 14:08 popler

Hi @popler we don't have a plan as of today, but contributions are always welcome ;-)

mangui avatar Aug 22 '17 06:08 mangui

Here is a link to that section in Apples RFC: https://tools.ietf.org/html/rfc8216#section-4.3.4.1.1

I'd also be interested in that feature. It seems to me, that it shouldn't be too hard to implement, if you already know how to switch between different bitrates and already support alternate audio renditions.

tmoehle avatar Sep 29 '17 20:09 tmoehle

I would also be interested ... Any plan to do it? Other hls libraries have done it (videojs-hls-contrib)

Llorito avatar Dec 18 '17 11:12 Llorito

no plan, anybody feel free to contribute

mangui avatar Dec 21 '17 01:12 mangui

hey, i have added this feature last year in our fork of videojs-contrib-hls. it would be great to have it in Hls.js as well to use this library for those types of applications. @tmoehle @Llorito @popler feel free to contact me about this.

tchakabam avatar Jan 04 '18 20:01 tchakabam

@tchakabam can't you create a PR on hls.js ?

I have modified current code a bit, and I am able to get the video tracks:

...
    // Ripoff of audio tracks parsing
    var videoGroups = levels.map(function (level) {
      return {
        id: level.attrs.VIDEO,
        codec: level.audioCodec
      };
    });
    var videoTracks = m3u8_parser.parseMasterPlaylistMedia(string, url, 'VIDEO', videoGroups);
    if (videoTracks.length) {
      var embeddedVideoFound = false;
      videoTracks.forEach(function (audioTrack) {
        if (!audioTrack.url) {
          embeddedVideoFound = true;
        }
      });
      if (embeddedVideoFound === false && levels[0].videoCodec && !levels[0].attrs.VIDEO) {
        logger["b" /* logger */].log('video codec signaled in quality level, but no embedded video track signaled, create one');
        videoTracks.unshift({
          type: 'main',
          name: 'main'
        });
      }
    }

    hls.trigger(events["a" /* default */].MANIFEST_LOADED, {
      levels: levels,
      audioTracks: audioTracks,
      videoTracks: videoTracks,
      subtitles: subtitles,
      url: url,
      stats: stats,
      networkDetails: networkDetails
    });
  };
...

Now they are exposed to MANIFEST_LOADED, problem now is, what API should one use to be able to switch to another video track ?

iongion avatar Feb 01 '18 13:02 iongion

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 15 '18 22:06 stale[bot]