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

feat: Allow set the videoContainer in the Player constructor #6953

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,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 @@ -559,7 +561,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
Loading