1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-13 01:30:17 +02:00

fix: Conditional requestVideoFrameCallback on Safari (#7854)

Safari's requestVideoFrameCallback is (intentionally?) broken when DRM is playing, so in that case use the fallback with requestAnimationFrame instead.
This commit is contained in:
mister-ben
2022-07-28 20:20:46 +02:00
committed by GitHub
parent ebe9f32f66
commit d178d9ae3c
2 changed files with 22 additions and 2 deletions

View File

@ -1044,3 +1044,20 @@ QUnit.test('featuresVideoFrameCallback is false for audio elements', function(as
audioTech.dispose();
});
QUnit.test('featuresVideoFrameCallback is false for Safari DRM', function(assert) {
// Looking for `super.requestVideoFrameCallback()` being called
const spy = sinon.spy(Object.getPrototypeOf(Object.getPrototypeOf(tech)), 'requestVideoFrameCallback');
tech.featuresVideoFrameCallback = true;
try {
tech.el_.webkitKeys = {};
tech.requestVideoFrameCallback(function() {});
assert.ok(spy.calledOnce, false, 'rvf fallback used');
} catch (e) {
// video.webkitKeys isn't writable on Safari, so relying on the mocked property on other browsers
assert.ok(true, 'skipped because webkitKeys not writable');
}
});