Skip to content

Commit

Permalink
feat: Allow set the videoContainer in the Player constructor (#6953)
Browse files Browse the repository at this point in the history
Related to
#6672 (comment)
  • Loading branch information
avelad committed Jul 8, 2024
1 parent 4d2aa24 commit a35028c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
* When provided, the player will attach to <code>mediaElement</code>,
* similar to calling <code>attach</code>. When not provided, the player
* will remain detached.
* @param {HTMLElement=} videoContainer
* The videoContainer to construct UITextDisplayer
* @param {function(shaka.Player)=} dependencyInjector Optional callback
* which is called to inject mocks into the Player. Used for testing.
*/
constructor(mediaElement, dependencyInjector) {
constructor(mediaElement, videoContainer = null, dependencyInjector) {
super();

/** @private {shaka.Player.LoadMode} */
Expand All @@ -560,7 +562,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
this.video_ = null;

/** @private {HTMLElement} */
this.videoContainer_ = null;
this.videoContainer_ = videoContainer;

/**
* Since we may not always have a text displayer created (e.g. before |load|
Expand Down
2 changes: 1 addition & 1 deletion test/offline/storage_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ filterDescribe('Storage', storageSupport, () => {
// Use a real Player since Storage only uses the configuration and
// networking engine. This allows us to use Player.configure in these
// tests.
player = new shaka.Player(null, ((player) => {
player = new shaka.Player(null, null, ((player) => {
player.createNetworkingEngine = () => netEngine;
}));
await player.attach(videoElement);
Expand Down
2 changes: 1 addition & 1 deletion test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('Player', () => {
}

video = new shaka.test.FakeVideo(20);
player = new shaka.Player(null, dependencyInjector);
player = new shaka.Player(null, null, dependencyInjector);
await player.attach(video);
player.configure({
// Ensures we don't get a warning about missing preference.
Expand Down

0 comments on commit a35028c

Please sign in to comment.