Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f3d115e

Browse files
fix: update playlist function syntax
1 parent ad78661 commit f3d115e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎src/PlayerScripts.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ true;
4848

4949
loadPlaylist: (playList, startIndex, play) => {
5050
const index = startIndex || 0;
51-
const playlistJson = JSON.stringify(playList);
5251
const func = play ? 'loadPlaylist' : 'cuePlaylist';
5352

54-
return `player.${func}({playlist: ${playlistJson}, index: ${index}); true;`;
53+
const list = typeof playList === 'string' ? `"${playList}"` : 'undefined';
54+
const listType =
55+
typeof playList === 'string' ? `"${playlist}"` : 'undefined';
56+
const playlist = Array.isArray(playList)
57+
? `"${playList.join(',')}"`
58+
: 'undefined';
59+
60+
return `player.${func}({listType: ${listType}, list: ${list}, playlist: ${playlist}, index: ${index}}); true;`;
5561
},
5662

5763
loadVideoById: (videoId, play) => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /