Skip to content

Commit

Permalink
fix(video): Change event type for setting up video element (#1133)
Browse files Browse the repository at this point in the history
Fixes issue for MacOS Catalina where `loadeddata` no longer firing in safari
  • Loading branch information
mickr authored and mergify[bot] committed Dec 21, 2019
1 parent 1671f64 commit f99bf5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/viewers/media/MediaBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/viewers/media/__tests__/MediaBaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down

0 comments on commit f99bf5a

Please sign in to comment.