Skip to content

Commit

Permalink
resume volume level
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcunat committed May 26, 2020
1 parent 80bb856 commit 69f6604
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions samples/chromecast/receiver/js/CastReceiverController.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ app.controller('CastReceiverController', ['$scope', 'dashPlayer', function($scop
graphUpdateInterval = 999,

update = function () {
var video = document.querySelector(".dash-video-player video"),
metrics;
var metrics;

metrics = dashPlayer.getMetricsFor("video");
if (metrics) {
Expand Down
5 changes: 4 additions & 1 deletion samples/chromecast/sender/js/CastSenderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ app.controller('CastSenderController', ['$scope', '$window', 'caster', function(
$scope.muted = isMuted;
}

this.onVolumeChange = function (level) {
$scope.volume = level;
}

this.onEnded = function () {

}
Expand All @@ -426,7 +430,6 @@ app.controller('CastSenderController', ['$scope', '$window', 'caster', function(
$scope.state = STATE_CASTING;
$scope.playing = mediaSession.playerState === 'PLAYING';
$scope.muted = mediaSession.volume.muted;
$scope.volume = mediaSession.volume.level;
$scope.$apply();
}
}
Expand Down
5 changes: 5 additions & 0 deletions samples/chromecast/sender/js/CastSenderService.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ angular.module('DashCastSenderApp.services', [])
delegate.onMutedChange(remotePlayer.isMuted);
}
});
remotePlayerController.addEventListener(cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED, () => {
if (remotePlayer) {
delegate.onVolumeChange(remotePlayer.volumeLevel);
}
});
},

sendMessage = function(command, attrs, callback) {
Expand Down

0 comments on commit 69f6604

Please sign in to comment.