From 2cfaf366e971e1babe1c7edcde06f18c90de3cfb Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 6 Jan 2017 12:33:41 -0800 Subject: [PATCH] Add missing events and methods to cast proxy The emsg, loading, and unloading events were present in v2.0.0. The drmInfo, isInProgress, and keySystem method were also present in v2.0.0. The getPlayheadTimeAsDate method was introduced in v2.0.1. None of these were proxied to the cast device until now. All v2.0.x events and methods are now being proxied. Change-Id: I6fba60f4ca451053c1449cafcddd9c1006292ad9 --- lib/cast/cast_utils.js | 13 ++++++++++--- test/cast/cast_receiver_unit.js | 15 ++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/cast/cast_utils.js b/lib/cast/cast_utils.js index f592e0303..a2b4234a4 100644 --- a/lib/cast/cast_utils.js +++ b/lib/cast/cast_utils.js @@ -92,7 +92,10 @@ shaka.cast.CastUtils.VideoVoidMethods = [ shaka.cast.CastUtils.PlayerEvents = [ 'adaptation', 'buffering', + 'emsg', 'error', + 'loading', + 'unloading', 'texttrackvisibility', 'trackschanged' ]; @@ -103,14 +106,18 @@ shaka.cast.CastUtils.PlayerEvents = [ * @const {!Array.} */ shaka.cast.CastUtils.PlayerGetterMethods = [ + 'drmInfo', 'getConfiguration', 'getManifestUri', 'getPlaybackRate', + 'getPlayheadTimeAsDate', 'getTracks', 'getStats', 'isBuffering', + 'isInProgress', 'isLive', 'isTextTrackVisible', + 'keySystem', 'seekRange' ]; @@ -140,13 +147,13 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [ * @const {!Array.} */ shaka.cast.CastUtils.PlayerVoidMethods = [ + 'addTextTrack', + 'cancelTrickPlay', 'configure', 'resetConfiguration', - 'trickPlay', - 'cancelTrickPlay', 'selectTrack', 'setTextTrackVisibility', - 'addTextTrack' + 'trickPlay' ]; diff --git a/test/cast/cast_receiver_unit.js b/test/cast/cast_receiver_unit.js index 85ac76865..443c834da 100644 --- a/test/cast/cast_receiver_unit.js +++ b/test/cast/cast_receiver_unit.js @@ -659,20 +659,25 @@ describe('CastReceiver', function() { function createMockPlayer() { var player = { + configure: jasmine.createSpy('configure'), + destroy: jasmine.createSpy('destroy'), + drmInfo: jasmine.createSpy('drmInfo'), getConfiguration: jasmine.createSpy('getConfiguration'), getManifestUri: jasmine.createSpy('getManifestUri'), getPlaybackRate: jasmine.createSpy('getPlaybackRate'), + getPlayheadTimeAsDate: jasmine.createSpy('getPlayheadTimeAsDate'), getTracks: jasmine.createSpy('getTracks'), getStats: jasmine.createSpy('getStats'), isBuffering: jasmine.createSpy('isBuffering'), + isInProgress: jasmine.createSpy('isInProgress'), isLive: jasmine.createSpy('isLive'), isTextTrackVisible: jasmine.createSpy('isTextTrackVisible'), - seekRange: jasmine.createSpy('seekRange'), - configure: jasmine.createSpy('configure'), - setTextTrackVisibility: jasmine.createSpy('setTextTrackVisibility'), - setMaxHardwareResolution: jasmine.createSpy('setMaxHardwareResolution'), + keySystem: jasmine.createSpy('keySystem'), load: jasmine.createSpy('load'), - destroy: jasmine.createSpy('destroy'), + seekRange: jasmine.createSpy('seekRange'), + setMaxHardwareResolution: jasmine.createSpy('setMaxHardwareResolution'), + setTextTrackVisibility: jasmine.createSpy('setTextTrackVisibility'), + addEventListener: function(eventName, listener) { player.listeners[eventName] = listener; },