mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-16 16:16:40 +03:00
Don't create a UI if the app already has one.
If an app uses the shaka.ui.Overlay constructor to create a UI before our auto-detection code runs, they end up with two UIs one on top of the other. I personally think anyone should be grateful to get an extra UI or two, but people complain for some reason. Closes #2073. Change-Id: I793b5a7d8b5092a9b65426f5994019fde75bf957
This commit is contained in:
@@ -236,6 +236,11 @@ shaka.ui.Overlay = class {
|
||||
} else if (videos.length && !containers.length) {
|
||||
// Just the video elements were provided.
|
||||
for (const video of videos) {
|
||||
// If the app has already manually created a UI for this element,
|
||||
// don't create another one.
|
||||
if (video['ui']) {
|
||||
continue;
|
||||
}
|
||||
goog.asserts.assert(video.tagName.toLowerCase() == 'video',
|
||||
'Should be a video element!');
|
||||
|
||||
@@ -264,6 +269,11 @@ shaka.ui.Overlay = class {
|
||||
}
|
||||
} else {
|
||||
for (const container of containers) {
|
||||
// If the app has already manually created a UI for this element,
|
||||
// don't create another one.
|
||||
if (container['ui']) {
|
||||
continue;
|
||||
}
|
||||
goog.asserts.assert(container.tagName.toLowerCase() == 'div',
|
||||
'Container should be a div!');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user