Skip to content

Commit 2ae216a

Browse files
committed
revert: tech reset on src call
Resetting the tech on the src call was causing problems with the eme support. We revert the change for the time being and added an articule on the known issues sections with a workaround that integrators can implement.
1 parent ef954f5 commit 2ae216a

2 files changed

Lines changed: 26 additions & 19 deletions

File tree

docs/api/tutorials/Known Issues.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,30 @@ player.src({ src: 'urn:swi:video:48115940', type: 'srgssr/urn', disableTrackers:
136136
```
137137
Again, in this scenario you MUST NOT re-enable the tracking for `trackedPlayer`.
138138

139+
### Media keeps playing after an error occurs on loading a different source
140+
141+
Under certain cases the internal call to `src_` reload logic is not triggered. As a result, the
142+
previous media can continue playing in the background even though the new source failed to load.
143+
144+
#### Issue Details
145+
146+
- **Scenario:** An incompatible source error or a block reason when calling `player.src(...)`
147+
- **Affected Browser:** All
148+
- **Symptoms:** Media keeps playing in the background.
149+
150+
#### Solution
151+
152+
To address this issue call instead `player.loadMedia(...)` when loading a different media. The
153+
parameter is slightly different, please make sure you read the documentation:
154+
[player.loadMedia][loadMedia], for example:
155+
156+
```javascript
157+
// Use
158+
player.loadMedia({src:{src:'...', type:'...'}});
159+
160+
// Instead of
161+
// player.src({src:'....', type:'...'});
162+
```
163+
139164
[ios-bug]: https://bugs.webkit.org/show_bug.cgi?id=261512
165+
[loadMedia]: https://docs.videojs.com/player#loadMedia

src/components/player.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,25 +163,6 @@ class Player extends vjsPlayer {
163163
return ranges;
164164
}
165165

166-
/**
167-
* Overrides the default `src` behavior to ensure the underlying tech is fully
168-
* reset before setting a new source.
169-
*
170-
* This is a workaround for a Video.js issue where, under certain failure cases the
171-
* internal `src_` reload logic is not triggered. As a result, the previous media
172-
* can continue playing in the background even though the new source failed.
173-
*
174-
* @see https://docs.videojs.com/player#src
175-
*/
176-
src(source) {
177-
if (source) {
178-
this.poster(null);
179-
this.techCall_('reset');
180-
}
181-
182-
super.src(source);
183-
}
184-
185166
/**
186167
* A getter/setter for the media's text track.
187168
* Activates the text track according to the language and kind properties.

0 commit comments

Comments
 (0)