Skip to content

Commit 2f987ae

Browse files
committed
HFP-3143 Add listener for canplay video event that resizes
Some videos may resize their client dimensions when the canplay event is triggered, so we must react to this by resizing.
1 parent 59827cb commit 2f987ae

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/scripts/interactive-video.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,21 +282,16 @@ function InteractiveVideo(params, id, contentData) {
282282

283283
// Handle video source loaded events (metadata)
284284
self.video.on('loaded', function () {
285-
// If already loaded, just trigger resize. This is necessary
286-
// because some browsers does not handle certain events from
287-
// video, e.g. Safari only handles the 'loadedmetadata' event,
288-
// while FF handles both 'loadedMetadata' and 'canplay' so we want
289-
// to make sure we resize after the last load event we get.
290-
if (isLoaded) {
291-
self.trigger('resize');
292-
return;
293-
}
294-
295285
isLoaded = true;
296286
// Update IV player UI
297287
self.loaded();
298288
});
299289

290+
// Video may change size on canplay, so we must react by resizing
291+
self.video.on('canplay', function () {
292+
self.trigger('resize');
293+
});
294+
300295
self.video.on('error', function () {
301296
// Make sure splash screen is removed so the error is visible.
302297
self.removeSplash();

0 commit comments

Comments
 (0)