Skip to content

Commit b22a08a

Browse files
authored
fix: need to determine featuresVideoFrameCallback before setting source (#7812)
the tech needs to know whether or not the underlying element supports requestVideoFrameCallback before calling setSource Fixes #7807
1 parent fb43a69 commit b22a08a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/js/tech/html5.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Html5 extends Tech {
3939
const source = options.source;
4040
let crossoriginTracks = false;
4141

42+
this.featuresVideoFrameCallback = this.featuresVideoFrameCallback && this.el_.tagName === 'VIDEO';
43+
4244
// Set the source if one is provided
4345
// 1) Check if the source is new (if not, we want to keep the original so playback isn't interrupted)
4446
// 2) Check to see if the network state of the tag was failed at init, and if so, reset the source
@@ -114,8 +116,6 @@ class Html5 extends Tech {
114116
// into a `fullscreenchange` event
115117
this.proxyWebkitFullscreen_();
116118

117-
this.featuresVideoFrameCallback = this.featuresVideoFrameCallback && this.el_.tagName === 'VIDEO';
118-
119119
this.triggerReady();
120120
}
121121

test/unit/tech/html5.test.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,10 @@ QUnit.test('supports getting available media playback quality metrics', function
10351035

10361036
QUnit.test('featuresVideoFrameCallback is false for audio elements', function(assert) {
10371037
const el = document.createElement('audio');
1038-
const audioTech = new Html5({el});
1038+
const audioTech = new Html5({
1039+
el,
1040+
source: [{src: 'https://example.org/stream.m3u8'}]
1041+
});
10391042

10401043
assert.strictEqual(audioTech.featuresVideoFrameCallback, false, 'Html5 with audio element should not support rvf');
10411044

0 commit comments

Comments
 (0)