From 515581903bf3872c33f8cd7595b86fd6d4314f83 Mon Sep 17 00:00:00 2001 From: Mick Ryan Date: Fri, 20 Dec 2019 17:04:17 -0800 Subject: [PATCH] fix(video): Change event type for setting up video element Fixes issue for MacOS Catalina where `loadeddata` no longer firing in safari --- src/lib/viewers/media/MediaBaseViewer.js | 2 +- src/lib/viewers/media/__tests__/MediaBaseViewer-test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/viewers/media/MediaBaseViewer.js b/src/lib/viewers/media/MediaBaseViewer.js index 73b2b80b3..de38c9bd7 100644 --- a/src/lib/viewers/media/MediaBaseViewer.js +++ b/src/lib/viewers/media/MediaBaseViewer.js @@ -210,7 +210,7 @@ class MediaBaseViewer extends BaseViewer { */ addEventListenersForMediaLoad() { this.mediaEl.addEventListener('canplay', this.handleCanPlay); - this.mediaEl.addEventListener('loadeddata', this.loadeddataHandler); + this.mediaEl.addEventListener('loadedmetadata', this.loadeddataHandler); this.mediaEl.addEventListener('loadstart', this.handleLoadStart); } diff --git a/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js b/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js index abe34fc2b..38a4a02db 100644 --- a/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js +++ b/src/lib/viewers/media/__tests__/MediaBaseViewer-test.js @@ -124,7 +124,7 @@ describe('lib/viewers/media/MediaBaseViewer', () => { it('should load mediaUrl in the media element', () => { sandbox.stub(media, 'getRepStatus').returns({ getPromise: () => Promise.resolve() }); return media.load().then(() => { - expect(media.mediaEl.addEventListener).to.be.calledWith('loadeddata', media.loadeddataHandler); + expect(media.mediaEl.addEventListener).to.be.calledWith('loadedmetadata', media.loadeddataHandler); expect(media.mediaEl.addEventListener).to.be.calledWith('error', media.errorHandler); expect(media.mediaEl.src).to.equal('www.netflix.com'); });