public function getEmbedURL($encode = true)
    {
        $url = '';

        // PROTOCOL
        if ($this->getHTTPS()) {
            $url .= 'https://';
        } else {
            $url .= 'http://';
        }

        // DOMAIN
        if ($this->getCookies()) {
            $url .= 'www.youtube.com';
        } else {
            $url .= 'www.youtube-nocookie.com';
        }

        // PATH
        if ($this->isVideo()) {
            $url .= '/v/';
        } else {
            $url .= '/p/';
        }

        // ID
        if ($this->isVideo()) {
            $url .= $this->getID();
        } else {
            $url .= substr($this->getID(), 2);
        } // Playlists start with PL but YouTube doesn't want that

        // Build Query String
        $query = [];
        $query['version'] = 2;
        if ($this->getAutoplay()) {
            $query['autoplay'] = 1;
        }
        if ($this->getLoop()) {
            $query['loop'] = 1;
        }
        if ($this->getJSAPI()) {
            $query['enablejsapi'] = 1;
        }
        if ($this->isHD()) {
            $query['hd'] = 1;
        }
        $query['theme'] = $this->getTheme();

        $seperator = $encode ? '&amp;' : '&';
        $url .= '?'.http_build_query($query, $seperator);

        return $url;
    }
public function getEmbedURL($encode = true)
    {
        $url = '';

        // PROTOCOL
        if ($this->getHTTPS()) {
            $url .= 'https://';
        } else {
            $url .= 'http://';
        }

        // DOMAIN
        if ($this->getCookies()) {
            $url .= 'www.youtube.com';
        } else {
            $url .= 'www.youtube-nocookie.com';
        }

        // PATH
        if ($this->isVideo()) {
            $url .= '/v/';
        } else {
            $url .= '/p/';
        }

        // ID
        if ($this->isVideo()) {
            $url .= $this->getID();
        } else {
            $url .= substr($this->getID(), 2);
        } // Playlists start with PL but YouTube doesn't want that

        // Build Query String
        $query = [];
        $query['version'] = 2;
        if ($this->getAutoplay()) {
            $query['autoplay'] = 1;
        }
        if ($this->getLoop()) {
            $query['loop'] = 1;
        }
        if ($this->getJSAPI()) {
            $query['enablejsapi'] = 1;
        }
        if ($this->isHD()) {
            $query['hd'] = 1;
        }
        $query['theme'] = $this->getTheme();

        $seperator = $encode ? '&amp;' : '&';
        $url .= '?'.http_build_query($query, $seperator);

        return $url;
    }
public function getEmbedURL ( $ encode = true ) { $ url = '' ; // PROTOCOL if ( $ this -> getHTTPS ( ) ) { $ url .= 'https://' ; } else { $ url .= 'http://' ; } // DOMAIN if ( $ this -> getCookies ( ) ) { $ url .= 'www.youtube.com' ; } else { $ url .= 'www.youtube-nocookie.com' ; } // PATH if ( $ this -> isVideo ( ) ) { $ url .= '/v/' ; } else { $ url .= '/p/' ; } // ID if ( $ this -> isVideo ( ) ) { $ url .= $ this -> getID ( ) ; } else { $ url .= substr ( $ this -> getID ( ) , 2 ) ; } // Playlists start with PL but YouTube doesn't want that // Build Query String $ query = [ ] ; $ query [ 'version' ] = 2 ; if ( $ this -> getAutoplay ( ) ) { $ query [ 'autoplay' ] = 1 ; } if ( $ this -> getLoop ( ) ) { $ query [ 'loop' ] = 1 ; } if ( $ this -> getJSAPI ( ) ) { $ query [ 'enablejsapi' ] = 1 ; } if ( $ this -> isHD ( ) ) { $ query [ 'hd' ] = 1 ; } $ query [ 'theme' ] = $ this -> getTheme ( ) ; $ seperator = $ encode ? '&amp;' : '&' ; $ url .= '?' . http_build_query ( $ query , $ seperator ) ; return $ url ; }
Get Embed URL.

@param bool $encode

@return string
Get Embed URL .