Skip to content

Commit 6147e5f

Browse files
fix: sourceset and browser behavior inconsistencies (videojs#5054)
* We now trigger `sourceset` any time a `<source>` element is appended to a mediaEl with no source. * `load` should always fire a `sourceset` * `sourceset` should always be the absolute url.
1 parent ba2ae78 commit 6147e5f

File tree

5 files changed

+190
-192
lines changed

5 files changed

+190
-192
lines changed

src/js/player.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2612,9 +2612,11 @@ class Player extends Component {
26122612

26132613
if (!titleCaseEquals(sourceTech.tech, this.techName_)) {
26142614
this.changingSrc_ = true;
2615-
26162615
// load this technology with the chosen source
26172616
this.loadTech_(sourceTech.tech, sourceTech.source);
2617+
this.tech_.ready(() => {
2618+
this.changingSrc_ = false;
2619+
});
26182620
return false;
26192621
}
26202622

src/js/tech/html5.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ class Html5 extends Tech {
3535
constructor(options, ready) {
3636
super(options, ready);
3737

38-
if (options.enableSourceset) {
39-
this.setupSourcesetHandling_();
40-
}
41-
4238
const source = options.source;
4339
let crossoriginTracks = false;
4440

@@ -52,6 +48,11 @@ class Html5 extends Tech {
5248
this.handleLateInit_(this.el_);
5349
}
5450

51+
// setup sourceset after late sourceset/init
52+
if (options.enableSourceset) {
53+
this.setupSourcesetHandling_();
54+
}
55+
5556
if (this.el_.hasChildNodes()) {
5657

5758
const nodes = this.el_.childNodes;
@@ -117,6 +118,9 @@ class Html5 extends Tech {
117118
* Dispose of `HTML5` media element and remove all tracks.
118119
*/
119120
dispose() {
121+
if (this.el_.resetSourceset_) {
122+
this.el_.resetSourceset_();
123+
}
120124
Html5.disposeMediaElement(this.el_);
121125
this.options_ = null;
122126

0 commit comments

Comments
 (0)