Skip to content

Commit

Permalink
fix: stay paused after codec switch (#6108)
Browse files Browse the repository at this point in the history
When stream is paused and codec switch is done, stream resumes to play.
Moving setting autoplay from `canplay` to `canplaythrough` fixes this
issue.

Problem observed on Tizen 6 & 7.
  • Loading branch information
tykus160 committed Jan 16, 2024
1 parent d4cd66d commit e48438f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/media/media_source_engine.js
Expand Up @@ -1805,7 +1805,7 @@ shaka.media.MediaSourceEngine = class {

this.destroyer_.ensureNotDestroyed();

this.eventManager_.listenOnce(this.video_, 'canplay', () => {
this.eventManager_.listenOnce(this.video_, 'canplaythrough', () => {
this.destroyer_.ensureNotDestroyed();

this.video_.autoplay = previousAutoPlayState;
Expand Down
4 changes: 2 additions & 2 deletions test/media/media_source_engine_unit.js
Expand Up @@ -1247,7 +1247,7 @@ describe('MediaSourceEngine', () => {
const callback = addListenOnceSpy.calls.argsFor(0)[2];
callback();
expect(initSourceBufferSpy).toHaveBeenCalled();
expect(addListenOnceSpy.calls.argsFor(0)[1]).toBe('canplay');
expect(addListenOnceSpy.calls.argsFor(0)[1]).toBe('canplaythrough');
expect(video.autoplay).toBe(true);
expect(playSpy).not.toHaveBeenCalled();
} finally {
Expand Down Expand Up @@ -1314,7 +1314,7 @@ describe('MediaSourceEngine', () => {
const callback = addListenOnceSpy.calls.argsFor(0)[2];
callback();
expect(initSourceBufferSpy).toHaveBeenCalled();
expect(addListenOnceSpy.calls.argsFor(0)[1]).toBe('canplay');
expect(addListenOnceSpy.calls.argsFor(0)[1]).toBe('canplaythrough');
expect(video.autoplay).toBe(false);
expect(playSpy).toHaveBeenCalled();
} finally {
Expand Down

0 comments on commit e48438f

Please sign in to comment.