public function playlist($playlist)
    {
        $oldSource = $this->source;
        $this->source = $playlist;

        $parsedURL = parse_url($playlist);

        // 1 thing, assume playlist.
        if (count($parsedURL) === 1) {
            $this->type = static::TYPE_PLAYLIST;
            $this->id = $parsedURL['path'];

            return $this->cookies()->theme(static::THEME_LIGHT);
        }

        // both playlist types use list=

        $parsedQuery = explode('&', $parsedURL['query']);
        // Find list=
        foreach ($parsedQuery as $v) {
            if (substr(strtolower($v), 0, 5) == 'list=') {
                $this->type = static::TYPE_PLAYLIST;
                $this->id = substr($v, 5);

                return $this->cookies()->theme(static::THEME_LIGHT);
            }
        }

        // If we don't find list=, then its not a playlist.
        $this->source = $oldSource;
        throw new AudioPlayerException('Could not identify playlist');
    }
public function playlist($playlist)
    {
        $oldSource = $this->source;
        $this->source = $playlist;

        $parsedURL = parse_url($playlist);

        // 1 thing, assume playlist.
        if (count($parsedURL) === 1) {
            $this->type = static::TYPE_PLAYLIST;
            $this->id = $parsedURL['path'];

            return $this->cookies()->theme(static::THEME_LIGHT);
        }

        // both playlist types use list=

        $parsedQuery = explode('&', $parsedURL['query']);
        // Find list=
        foreach ($parsedQuery as $v) {
            if (substr(strtolower($v), 0, 5) == 'list=') {
                $this->type = static::TYPE_PLAYLIST;
                $this->id = substr($v, 5);

                return $this->cookies()->theme(static::THEME_LIGHT);
            }
        }

        // If we don't find list=, then its not a playlist.
        $this->source = $oldSource;
        throw new AudioPlayerException('Could not identify playlist');
    }
public function playlist ( $ playlist ) { $ oldSource = $ this -> source ; $ this -> source = $ playlist ; $ parsedURL = parse_url ( $ playlist ) ; // 1 thing, assume playlist. if ( count ( $ parsedURL ) === 1 ) { $ this -> type = static :: TYPE_PLAYLIST ; $ this -> id = $ parsedURL [ 'path' ] ; return $ this -> cookies ( ) -> theme ( static :: THEME_LIGHT ) ; } // both playlist types use list= $ parsedQuery = explode ( '&' , $ parsedURL [ 'query' ] ) ; // Find list= foreach ( $ parsedQuery as $ v ) { if ( substr ( strtolower ( $ v ) , 0 , 5 ) == 'list=' ) { $ this -> type = static :: TYPE_PLAYLIST ; $ this -> id = substr ( $ v , 5 ) ; return $ this -> cookies ( ) -> theme ( static :: THEME_LIGHT ) ; } } // If we don't find list=, then its not a playlist. $ this -> source = $ oldSource ; throw new AudioPlayerException ( 'Could not identify playlist' ) ; }
Set Player Playlist
Does not validate whether or not YouTube playlist exists.


@param string $playlist Can be a URL or just the ID

@throws AudioPlayerException

@return $this
Set Player Playlist Does not validate whether or not YouTube playlist exists .