add patches for playlist/play() exception debugging
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
diff --git a/src/playlist/playlist.js b/src/playlist/playlist.js
|
||||
index 82112fb..fcf4ade 100644
|
||||
index 82112fb..bf39681 100644
|
||||
--- a/src/playlist/playlist.js
|
||||
+++ b/src/playlist/playlist.js
|
||||
@@ -81,7 +81,7 @@ Object.assign(MediaElementPlayer.prototype, {
|
||||
@@ -81,10 +81,11 @@ Object.assign(MediaElementPlayer.prototype, {
|
||||
|
||||
player.endedCallback = () => {
|
||||
if (player.currentPlaylistItem < player.listItems.length) {
|
||||
@ -10,4 +10,58 @@ index 82112fb..fcf4ade 100644
|
||||
+ player.setSrc(player.playlist[++player.currentPlaylistItem].src);
|
||||
player.load();
|
||||
setTimeout(() => {
|
||||
player.play();
|
||||
- player.play();
|
||||
+ var _promise = player.play();
|
||||
+ console.log("play() returned promise at 'player.endedCallback': ", _promise);
|
||||
}, 200);
|
||||
}
|
||||
};
|
||||
@@ -172,7 +173,17 @@ Object.assign(MediaElementPlayer.prototype, {
|
||||
player.currentPlaylistItem = this.getAttribute('data-playlist-index');
|
||||
player.setSrc(this.value);
|
||||
player.load();
|
||||
- player.play();
|
||||
+ var isPlaying = player.media.currentTime > 0 && !player.media.paused && !player.media.ended && player.media.readyState > player.media.HAVE_CURRENT_DATA;
|
||||
+ if(isPlaying) {
|
||||
+ console.log("play() at 'inputs[i].addEventListener' not executed, because media is already playing");
|
||||
+ }
|
||||
+ else {
|
||||
+ var _promise = player.play();
|
||||
+ console.log("play() returned promise at 'inputs[i].addEventListener': ", _promise);
|
||||
+ _promise.catch((error) => {
|
||||
+ console.error(error);
|
||||
+ });
|
||||
+ }
|
||||
|
||||
if (player.isVideo && player.options.autoClosePlaylist === true) {
|
||||
mejs.Utils.toggleClass(player.playlistLayer, `${player.options.classPrefix}playlist-hidden`);
|
||||
@@ -224,7 +235,8 @@ Object.assign(MediaElementPlayer.prototype, {
|
||||
if (player.playlist[--player.currentPlaylistItem]) {
|
||||
player.setSrc(player.playlist[player.currentPlaylistItem].src);
|
||||
player.load();
|
||||
- player.play();
|
||||
+ var _promise = player.play();
|
||||
+ console.log("play() returned promise at 'player.prevPlaylistCallback': ", _promise);
|
||||
} else {
|
||||
++player.currentPlaylistItem;
|
||||
}
|
||||
@@ -249,7 +261,8 @@ Object.assign(MediaElementPlayer.prototype, {
|
||||
if (player.playlist[++player.currentPlaylistItem]) {
|
||||
player.setSrc(player.playlist[player.currentPlaylistItem].src);
|
||||
player.load();
|
||||
- player.play();
|
||||
+ var _promise = player.play();
|
||||
+ console.log("play() returned promise at 'player.nextPlaylistCallback': ", _promise);
|
||||
} else {
|
||||
--player.currentPlaylistItem;
|
||||
}
|
||||
@@ -312,7 +325,8 @@ Object.assign(MediaElementPlayer.prototype, {
|
||||
if (playedItems.indexOf(randomItem) === -1) {
|
||||
player.setSrc(player.playlist[randomItem].src);
|
||||
player.load();
|
||||
- player.play();
|
||||
+ var _promise = player.play();
|
||||
+ console.log("play() returned promise at 'randomizeCallback': ", _promise);
|
||||
player.currentPlaylistItem = randomItem;
|
||||
playedItems.push(randomItem);
|
||||
|
||||
|
Reference in New Issue
Block a user