Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Fix disabled audio for a single audio only source buffer #152

Merged
merged 3 commits into from
Jul 12, 2017

Conversation

mjneil
Copy link
Contributor

@mjneil mjneil commented Jul 10, 2017

When loading an audio only playlist, we would create a single source buffer that had only audio codecs. When changes to the audio tracks happen, the HtmlMediaSource would update which source buffer has ownership of audio. When the main audio track is enabled, we used the assumption that audio is muxed into the main playlist, and alternate audio is not being used, so audio would be enabled in the "combined" source buffer, and disabled in the "audio only" source buffer. However, in the case of audio only playlist, the "combined" source buffer would only have an audio codec, which was incorrectly being marked as the "audio only" source buffer, so audio would be disabled and prevent data from ever being appended.

This problem was hidden by a race condition between contrib-hls MasterPlaylistController completing the first media playlist request and the MediaSource triggering the sourceopen event. If the sourceopen event happened second, the audio track change event listeners would be setup later, avoiding this bug.

This change checks to see if there is only one source buffer, and if so make sure it is always active and enables audio based on the source buffer's audio codec information.

Addresses:
videojs/videojs-contrib-hls#1186
videojs/videojs-contrib-hls#1179

Audio only in Flash also has some issues when we detect that the type is audio/mp2t. This address that by allowing audio only FlashSourceBuffers to be created.

@forbesjo
Copy link
Contributor

Looks good to me

@mjneil mjneil merged commit 6678023 into videojs:master Jul 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants