AlexStack
AlexStack

Reputation: 17431

Initializing an empty player with Youtube Javascript API

I have made a component for my web app that initializes a YouTube player on the page. This player will be used to an un-demand video on to the page. However, when initializing the player, I have to pass a video for it to initialize:

//javascript
swfobject.embedSWF( makeUrl( 'http://www.youtube.com/v/NINOxRxze9k', {
                version : 3,//youtube api version
                autoplay : 0,//automatically start playing
                color : 'white',//color for the 'viewed' part of the video
                autohide : 0,//automatically hide the controls
                controls : 0,//don't show the controls
                disablekb : 1,//disable keyboard shortcuts
                enablejsapi : 1,//enable javascript api
                fs : 0,//disable full-screen
                playerapiid : id,//player api id that is used for javascript api
                //playlist : videoIds.join( ',' ),//the list of video ids to play (it can be only one item)
                showinfo : 0,//don't show video information like title
                rel : 0,//don't show related videos after playback is finished
                theme : 'light',//use the light theme (the other one is 'dark')
                showsearch : 0, //don't show the search bar (it's disabled when 'rel' is 0)
                origin : window.location.hostname//it is a security thing necessary for enabling javascript api
            }), id, '300', '200', '8', null, null, params, atts);

(notice the 'NINOxRxze9k' part on the first line).

The question is: how can I initialize a YouTube player without initializing it for a specific video? I don't want it to show a snapshot of the video ready to be played. I want it to be blank before I start playing anything on it.

Sitenote: as you can see from Google's documentation, the VIDEO_ID is passed to embedSWF(). I tried removing it but it stopped working.

Upvotes: 1

Views: 4105

Answers (2)

Tempus
Tempus

Reputation: 785

Not sure if this will help but here it is anyway.

I have played with YT-api for a while in flash and web for different projects and found it to be a LARG system that takes a lot of reading. The only time I have found it to have a blank player loaded was in a flash app. Also it needed to be chromeles.

I did an "amature" tutorial with download for people here. http://www.youtubetutsite.com/player.php?videoID=kO_WVIYdLDc

Only sugesting as you are using the SWF player in your app.

Upvotes: 0

Matias Molinas
Matias Molinas

Reputation: 2296

I think that this is the answer to the same question, but if you use the Player IFrame API:

Init YouTube iframe player without video ID

Upvotes: 1

Related Questions