Skip to content

Commit

Permalink
Youtube playlist fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
webmiraclepro committed Dec 31, 2018
1 parent f90a9bf commit 99a0abe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/demo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class App extends Component {
<td>
{this.renderLoadButton('https://www.youtube.com/watch?v=oUFJJNQGwhk', 'Test A')}
{this.renderLoadButton('https://www.youtube.com/watch?v=jNgP6d9HraI', 'Test B')}
{this.renderLoadButton('https://www.youtube.com/playlist?list=PLDEcUiPhzbjI217qs5KgMvbvx6-fgY_Al', 'Playlist')}
</td>
</tr>
<tr>
Expand Down
5 changes: 4 additions & 1 deletion src/players/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const MATCH_PLAYLIST = /list=([a-zA-Z0-9_-]+)/
function parsePlaylist (url) {
if (MATCH_PLAYLIST.test(url)) {
const [, playlistId] = url.match(MATCH_PLAYLIST)
console.log(playlistId)
return {
listType: 'playlist',
list: playlistId
Expand All @@ -31,6 +30,10 @@ export class YouTube extends Component {
const { playerVars } = config.youtube
const id = url && url.match(MATCH_URL)[1]
if (isReady) {
if (MATCH_PLAYLIST.test(url)) {
this.player.loadPlaylist(parsePlaylist(url))
return
}
this.player.cueVideoById({
videoId: id,
startSeconds: parseStartTime(url) || playerVars.start,
Expand Down

0 comments on commit 99a0abe

Please sign in to comment.