Skip to content

Commit

Permalink
fix(vgMedia): playPromise failures now remove the playPromise referen…
Browse files Browse the repository at this point in the history
…ce to play can be attempted aga

playPromise attempts that are rejected drop into the catch block and were not clearing the
playPromise reference causing all subsequent attempts to play the media to fail.  The initial
if-statement checks for the existence of a playPromise and returns out if it currently exists.  This
meant that autoplay videos rejected by Safari or Chrome could not be played, even by clicking the
play button.  This change nulls out of the playPromise reference with both successful and
unsuccessful play attempts allowing future calls to play() (for example, during a click event of the
play button) the possiblity to succeed.

#724
  • Loading branch information
kwarismian committed May 25, 2018
1 parent 05cddb6 commit d0168a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/vg-media/vg-media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export class VgMedia implements OnInit, OnDestroy, IPlayable {
this.playPromise = null;
})
.catch(() => {
this.playPromise = null;
// deliberately empty for the sake of eating console noise
});
}
Expand Down

0 comments on commit d0168a6

Please sign in to comment.