@@ -96,12 +96,11 @@ export const MAIN_SCRIPT = (
9696 const modestbranding_s = modestbranding ? 1 : 0 ;
9797 const preventFullScreen_s = preventFullScreen ? 0 : 1 ;
9898 const showClosedCaptions_s = showClosedCaptions ? 1 : 0 ;
99- const list = typeof playList === 'string' ? playList : '' ;
100- const listType = typeof playList === 'string' ? 'playlist' : '' ;
10199 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 ;
105104
106105 // scale will either be "initial-scale=1.0"
107106 let scale = `initial-scale=${ contentScale_s } ` ;
@@ -131,8 +130,14 @@ export const MAIN_SCRIPT = (
131130 showClosedCaptions_s,
132131 } ;
133132
133+ console . log ( { safeData} ) ;
134+
134135 const urlEncodedJSON = encodeURI ( JSON . stringify ( safeData ) ) ;
135136
137+ const listParam = list ? `list: '${ list } ',` : '' ;
138+ const listTypeParam = listType ? `listType: '${ list } ',` : '' ;
139+ const playlistParam = playList ? `playlist: '${ playList } ',` : '' ;
140+
136141 const htmlString = `
137142<!DOCTYPE html>
138143<html>
@@ -179,16 +184,17 @@ export const MAIN_SCRIPT = (
179184 height: '1000',
180185 videoId: '${ videoId_s } ',
181186 playerVars: {
182- ${ playlist }
187+ ${ listParam }
188+ ${ listTypeParam }
189+ ${ playlistParam }
190+
183191 end: ${ end } ,
184192 rel: ${ rel_s } ,
185193 playsinline: 1,
186194 loop: ${ loop_s } ,
187195 color: ${ color } ,
188196 start: ${ start } ,
189- list: '${ list } ',
190197 hl: ${ playerLang } ,
191- listType: '${ listType } ',
192198 controls: ${ controls_s } ,
193199 fs: ${ preventFullScreen_s } ,
194200 cc_lang_pref: '${ cc_lang_pref_s } ',
@@ -242,5 +248,6 @@ export const MAIN_SCRIPT = (
242248</html>
243249` ;
244250
251+ console . log ( htmlString ) ;
245252 return { htmlString, urlEncodedJSON} ;
246253} ;
0 commit comments