@@ -96,12 +96,11 @@ export const MAIN_SCRIPT = (
96
96
const modestbranding_s = modestbranding ? 1 : 0 ;
97
97
const preventFullScreen_s = preventFullScreen ? 0 : 1 ;
98
98
const showClosedCaptions_s = showClosedCaptions ? 1 : 0 ;
99
- const list = typeof playList === 'string' ? playList : '' ;
100
- const listType = typeof playList === 'string' ? 'playlist' : '' ;
101
99
const contentScale_s = typeof contentScale === 'number' ? contentScale : 1.0 ;
102
- const playlist = Array . isArray ( playList )
103
- ? `playlist: "${ playList . join ( ',' ) } ",`
104
- : '' ;
100
+
101
+ const list = typeof playList === 'string' ? playList : undefined ;
102
+ const listType = typeof playList === 'string' ? 'playlist' : undefined ;
103
+ const playlist = Array . isArray ( playList ) ? playList . join ( ',' ) : undefined ;
105
104
106
105
// scale will either be "initial-scale=1.0"
107
106
let scale = `initial-scale=${ contentScale_s } ` ;
@@ -131,8 +130,14 @@ export const MAIN_SCRIPT = (
131
130
showClosedCaptions_s,
132
131
} ;
133
132
133
+ console . log ( { safeData} ) ;
134
+
134
135
const urlEncodedJSON = encodeURI ( JSON . stringify ( safeData ) ) ;
135
136
137
+ const listParam = list ? `list: '${ list } ',` : '' ;
138
+ const listTypeParam = listType ? `listType: '${ list } ',` : '' ;
139
+ const playlistParam = playList ? `playlist: '${ playList } ',` : '' ;
140
+
136
141
const htmlString = `
137
142
<!DOCTYPE html>
138
143
<html>
@@ -179,16 +184,17 @@ export const MAIN_SCRIPT = (
179
184
height: '1000',
180
185
videoId: '${ videoId_s } ',
181
186
playerVars: {
182
- ${ playlist }
187
+ ${ listParam }
188
+ ${ listTypeParam }
189
+ ${ playlistParam }
190
+
183
191
end: ${ end } ,
184
192
rel: ${ rel_s } ,
185
193
playsinline: 1,
186
194
loop: ${ loop_s } ,
187
195
color: ${ color } ,
188
196
start: ${ start } ,
189
- list: '${ list } ',
190
197
hl: ${ playerLang } ,
191
- listType: '${ listType } ',
192
198
controls: ${ controls_s } ,
193
199
fs: ${ preventFullScreen_s } ,
194
200
cc_lang_pref: '${ cc_lang_pref_s } ',
@@ -242,5 +248,6 @@ export const MAIN_SCRIPT = (
242
248
</html>
243
249
` ;
244
250
251
+ console . log ( htmlString ) ;
245
252
return { htmlString, urlEncodedJSON} ;
246
253
} ;
0 commit comments