videojs / videojs-contrib-hls

HLS library for video.js
http://videojs.github.io/videojs-contrib-hls/
Other
2.84k stars 791 forks source link

Only audio with multiple renditions / tracks #1405

Closed hector closed 5 years ago

hector commented 6 years ago

Description

I am trying to play an audio with multiple renditions, e.g. I attach an example were the main audio is in French and I have an alternate audio in English. videojs-contrib-hls is playing the main audio (French) correctly, it is also reading correctly that there are two languages (showing them in the control bar) but when selecting the alternate rendition (English) the audio will not change. I don't know if this is a feature that is lacking or I should write a different M3U8 file.

Test case: http://jsbin.com/yijitogoji/1/edit?html,output

The same M3U8 is working in this other player: https://bitmovin.com/hls-mpeg-dash-test-player/

M3U8 link: https://s3-eu-west-1.amazonaws.com/media.voctrolabs/development/voiceful_studio/rice/audio.m3u8

M3U8 is like this:

#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="French",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="fr"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English",DEFAULT=NO,AUTOSELECT=NO,LANGUAGE="en",URI="video_audio_track_english.m3u8"
#EXT-X-STREAM-INF:AUDIO="audio"
video_audio_track_french.m3u8

Results

Expected

I should be able to change the audio.

Error output

No errors thrown.

Additional Information

I tried to follow this words from the HLS specification: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.4.2.1

The URI attribute of the EXT-X-MEDIA tag is REQUIRED if the media type is SUBTITLES, but OPTIONAL if the media type is VIDEO or AUDIO. If the media type is VIDEO or AUDIO, a missing URI attribute indicates that the media data for this Rendition is included in the Media Playlist of any EXT-X-STREAM-INF tag referencing this EXT-X-MEDIA tag. If the media TYPE is AUDIO and the URI attribute is missing, clients MUST assume that the audio data for this Rendition is present in every video Rendition specified by the EXT-X-STREAM-INF tag.

The same audio files but including a video work fine; example: http://jsbin.com/jovoralubu/1/edit?html,output

videojs-contrib-hls version

videojs-contrib-hls 5.12.2

videojs version

video.js 6.4.0

Browsers

Platforms

Other Plugins

No

namor commented 6 years ago

Try setting AUTOSELECT to YES

Surprisingly you got the DEFAULT option to work (on bitmovin). They renamed the option in production to is_default last tuesday

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English",DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="en",URI="video_audio_track_english.m3u8"

hector commented 6 years ago

Thanks for the suggestion!

Still, it does not make it work :(

http://jsbin.com/rijezonira/1/edit?html,output

hector commented 6 years ago

Could someone at least tell me if this is a problem of my m3u8 or videojs-contrib-hls behaviour? If it is the latter I can try to dig into the code.

hector commented 5 years ago

I have been able to make this work with the new version 7 of video.js which uses https://github.com/videojs/http-streaming instead of videojs-contrib-hls.

murtaz53 commented 5 years ago

@hector : can you share the solution here (i.e jsfiddle)? how you have switch audio quality using default/autoselect? I have written as below, but it's not working.

player.tech_.hls.masterPlaylistController_.mediaTypes_.AUDIO.groups[name][0].autoselect=true
player.tech_.hls.masterPlaylistController_.mediaTypes_.AUDIO.groups[name][0].default=true
hector commented 5 years ago

I do it like this:

// Change audio track
const audioTrack = player.audioTracks().tracks_.find(track => track.language === language);
if (audioTrack) audioTrack.enabled = true;

I suggest you first pause the video in case it is playing, then play it again.

murtaz53 commented 5 years ago

@hector : I am asking about audio quality not audio track. I have 2 audio quality/group i.e stereo and surround. how to switch quality stereo/surround. I have already handled audio track switch i.e english and dubbing.

see the below link there is audio quality option. I am talking about it. https://bitmovin.com/demos/stream-test?format=hls&manifest=https%3A%2F%2Fbitdash-a.akamaihd.net%2Fcontent%2Fsintel%2Fhls%2Fplaylist.m3u8

hector commented 5 years ago

This issue was about having videojs play multiple audios (e.g. with different languages) without a video. Not about different qualities for the same audio. That's a different thing, I don't know how to do what you ask because I use a single quality in my audios.

murtaz53 commented 5 years ago

ok thanks hector

murtaz53 commented 5 years ago

@heff : can you help?

gkatsev commented 5 years ago

@murtaz53 can you open a new detailed issue about the problem? What you're doing, what you're expecting, what's happening etc.

murtaz53 commented 5 years ago

@gkatsev : I have open a new detailed issue about the problem #1450