Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch volumechange from the native video element via dedicated Med… #3969

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ declare namespace dashjs {
PLAYBACK_STALLED: 'playbackStalled';
PLAYBACK_STARTED: 'playbackStarted';
PLAYBACK_TIME_UPDATED: 'playbackTimeUpdated';
PLAYBACK_VOLUME_CHANGED: 'playbackVolumeChanged';
PLAYBACK_WAITING: 'playbackWaiting';
PROTECTION_CREATED: 'public_protectioncreated';
PROTECTION_DESTROYED: 'public_protectiondestroyed';
Expand Down
6 changes: 6 additions & 0 deletions src/streaming/MediaPlayerEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ class MediaPlayerEvents extends EventsBase {
*/
this.PLAYBACK_TIME_UPDATED = 'playbackTimeUpdated';

/**
* Sent when the video element reports that the volume has changed
* @event MediaPlayerEvents#PLAYBACK_VOLUME_CHANGED
*/
this.PLAYBACK_VOLUME_CHANGED = 'playbackVolumeChanged';

/**
* Sent when the media playback has stopped because of a temporary lack of data.
*
Expand Down
6 changes: 6 additions & 0 deletions src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,10 @@ function PlaybackController() {
eventBus.trigger(Events.PLAYBACK_ENDED, { 'isLast': streamInfo.isLast });
}

function _onVolumeChanged() {
eventBus.trigger(Events.PLAYBACK_VOLUME_CHANGED);
}

// Handle DASH PLAYBACK_ENDED event
function _onPlaybackEnded(e) {
if (wallclockTimeIntervalId && e.isLast) {
Expand Down Expand Up @@ -771,6 +775,7 @@ function PlaybackController() {
videoModel.addEventListener('loadeddata', _onPlaybackLoadedData);
videoModel.addEventListener('stalled', onPlaybackStalled);
videoModel.addEventListener('ended', _onNativePlaybackEnded);
videoModel.addEventListener('volumechange', _onVolumeChanged);
}

function removeAllListeners() {
Expand All @@ -790,6 +795,7 @@ function PlaybackController() {
videoModel.removeEventListener('loadeddata', _onPlaybackLoadedData);
videoModel.removeEventListener('stalled', onPlaybackStalled);
videoModel.removeEventListener('ended', _onNativePlaybackEnded);
videoModel.removeEventListener('volumechange', _onVolumeChanged);
}

instance = {
Expand Down