Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Can't connect to youtube. only one youtube allowed

28 replies [Last post]

" Cannot connect to youtube. only one youtube connection per computer can be made "

i want to be able to load two or more different youtube movies at the same time on the same computer, i am using JW player 4.0.
i have all the source files needed.
please help me what can i do?

thanks

any idea?
help please.

Bewler? Bewler?

This is happening consistantly, and most of the time the youtube playlist isnt even loading???

cheers

Well, I've been stugling with it for the past 4 hours, and I've finally managed to succeed. Yuhey! :)

Multiple youtubes work fine, as long as only one at a time is streaming.

Procedure:
You need to call

document.getElementById("player_id").sendEvent("STOP");
/* per http://code.longtailvideo.com/trac/wiki/FlashAPI */

before playing another youtube.
If you have multiple players on a page, you obviously need to set some kind of onplay handler that will stop the previous (or all other) players.
If you insert players with JS, your need to call the above-stated function, before clearing the div and inserting a new swfobject.

** It obviously doesn't work on pure <embed /> and
** it doesn't work locally!

Explaination:
YouTube API is naturally limited. If only one connection per host allowed, then we need to kill that connection down before establishing a new one. JW's player obviously notifies youtube's api on a STOP ( sendEvent("STOP") ).

It's all great limiting and all... if it just were better documented. (Youtube & JW!)
Need moar examples! :)
</del>

EDIT: Nope, apparently it works *currently* in Firefox, STOPped or not. I can't seem to get it up in Opera, however. I suppose it doesn't drop the connection properly, so I am reverting to Youtube embeded player. It has fullscreen now :} ...which of course doesn't work in Opera. It's all Adobe's fault.

i cannot connect to you tube

I was facing this issue in IE7. On my site, the repro was simple -

- play a youtube video
- refresh page while video is playing
- try to play a youtube video
I would get the "one youtube connection per computer" error.

Here's why -
When event handlers are set on the player using addModelListener(), etc, they caused circular references on the player's <object> node. IE is unable to kill the player instance when navigating away - a typical IE memory leak. After refresh a new instance of player would be created, but because the previous instance is still alive (and buffering), youtube would prevent the new instance from buffering.

Here's how I fixed it -
Using 'drip' and 'js memory leak detector' tools, I first confirmed that the player instance is getting leaked. The methods I called on the player were holding on to the player's instance. Setting those functions to null before navigating away breaks the circular references. And here's the code -

window.onbeforeunload = function (oEvent)
{
var p = getPlayer();

// Stop buffering
p.sendEvent("STOP");

// Break circular references
p.getConfig = null;
p.getPlaylist = null;
p.addControllerListener = null;
p.addModelListener = null;
p.addViewListener = null;
p.sendEvent = null;
}

HTH...

Great, just what I needed!

ich have multiple players on my site and the work as espected with local files, but with youtube and the yt.swf always the first youtube-file player is activated by the other ones again.

seems the above example could solve my problem, but how to implement this?
where do i have to place the above code and how to activate it?

Hey, I love the youtube functionality, but the only 1 stream at a time is a big problem, especially if a user opens multiple videos in more than one window/tab.

I notice there are no problems showing multiple videos via YT's chromeless player, so the issue is obviously at the JW end?

ImI thinking the problem is cause by the proxy yt script.

YT API has this to say:

When loading multiple player SWFs, (including loading a new player SWF in place of a previous player) you will need to load the player into a MovieClip with a different name than previous players. For example, if you loaded a video into _root.youtubeplayer, when you want to load a new player, you would use something like _root.youtubeplayer2, and so on.

When unloading a YouTube player, you should always call destroy() first. This will close the NetStream object and stop the video from continuing to download even after the player has been unloaded. It will also remove references to the player SWF so if you load a new player SWF into your application, the new SWF can load and initialize properly.

I'm not great at AS, any help on fixing this would be mucho appreciated.as I would love to add this functionality to my site.

Yep thas is correct its as easy as that :)
I don't understand why jeroen isnt changing this?

It still isnt possible to add more then 1 youtube player on 1 page becuase of limitations.
But it is possible to have them load at more windows by giving them different names.

Hopefully he will change this someday =)

*jeroen if you dont know how to do it just reply here i will give you an example =)

Hey Kees,

I've tried getting this to work in multiple windows, but still having no joy.

I assume by giving them different names, you mean in the embed?

Currently i'm using var so = new SWFObject('player.swf','mpl<?=time()?>','480','530','9','#000000');

Which gives me a random name for each player, but I still can't play in multiple windows without the dreaded 'no more than 1 youtube video allowed at 1 time' error.

Any ideas?

No in the yt.as =)
Jeroen is using the same name to connect to youtube because of it being a local connection the name can only be used once, so if you want to fix this take a random name to connect to youtube.

Hi,

I am very new to AS, Can you please tell me how to fix this. what change i have to make exactly?

thanks
kannan C

I too am having the same issue. In Internet Explorer if we open a file, refresh the page and click the player to play again, it will display the error ???Why is jeroen not making the change. Without this function the Youtube usage is a BIG NO ???? The funny thing is that there are no problems showing multiple videos via YT's chromeless player....

To instantiate many YouTube objects?

You need to have unique name for LocalConnection, that can be done by
creating pair of unique names (prefix+ Math.random () * currentTime)
in AS3 wrapper, pass these names to AS2 wrapper (for youtube player)
via query-string while making _loader.load (..). That way you can use
exchange the localconnection names.

Jane, could you explain a little more on how you go about doing this? thanks

Hello!

Really an ugly thing with the old 3.16 mediaplayer working well, even with more than one player connecting to youtube simultanously and the new player looking into the mirror, what is the best player all over the country. It is 3.16.

I need the new player because it is skinnable and I could use plugins, but I still use 3.16 because it seems to be still the only one, I can have for several reasons, like youtube, captions and more.

But I guess this problems could be solved, if not one problem is causing the other.

Thank you very much for the player. It is great.

Bernhard

Anyone has any luck resolving this issue. can someone explain how to fix this problem please please...

Jane, how to send unique name to onload or something? is that done through java script or is that in the player AS3 code?

Yep, I'm still having this problem as well :(

i discovered this issue today. i would like to stay with the latest version and still play more than one video on my site.

is it not possible with this version at all? i would much appreciate your help since i really don't want to downgrade to 3.16.

and yes: i don't think it's through to youtube's regulations because it is possible to use multiple chromeless players on one page.

it would seem to be somewhat fixed in the next version (v.4.3)
please see the roadmap ticket #274 - http://code.jeroenwijering.com/trac/roadmap

So from where can I download the 4.3 version?

To download players and plugins, go to The JW Player Wiki which is linked at the top of this page.

I am trying to use your FLV player from YouJoomla. I installed it ftp to cpanel, went to the backend added the code provided by YouJoomla and then created a playlist uploaded flv videos, and pix. The code that I put in the module to have this display keeps disappearing so that all you see is a spinning circle like it is loading. This is the code that I am adding.
<script type="text/javascript" src="templates/newsline2/jw_player/swfobject.js"></script>
<div id="youjoomla_videos" align="center"><img title="" alt="" src="templates/newsline2/jw_player/loading1.gif" /><p><strong>Newsline II Video is loading. Please wait...</strong></p>&nbsp;<br />
<p><strong>If you are not able to see Newsline II Video</strong></p>
<p><a href="http://www.adobe.com/go/getflashplayer"><img style="margin-top: 1em;" src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

</div>

<script type="text/javascript">
window.addEvent('domready', function(){
var youjoomla = new SWFObject('templates/newsline2/jw_player/mediaplayer.swf','mpl','635','300','8');
youjoomla.addParam('allowscriptaccess','always');
youjoomla.addParam('allowfullscreen','true');
youjoomla.addParam("quality", "high");
youjoomla.addVariable('height','300');
youjoomla.addVariable('width','635');
youjoomla.addParam('wmode', 'opaque');
youjoomla.addVariable('file','templates/newsline2/jw_player/playlist.xml');
youjoomla.addVariable('backcolor','0x000000');
youjoomla.addVariable('frontcolor','0xF7F7F7');
youjoomla.addVariable('lightcolor','0x999999');
youjoomla.addVariable('logo','templates/newsline2/jw_player/thumbs/logo.png');
youjoomla.addVariable('displayheight','300');
youjoomla.addVariable('displaywidth','400');
youjoomla.addVariable('searchbar','false');
youjoomla.addVariable('autoscroll','true');
youjoomla.addVariable('overstretch','true');
youjoomla.addVariable('showstop','true');
youjoomla.addVariable('showdownload','true');
youjoomla.addVariable('shuffle','true');
youjoomla.useExpressInstall('templates/newsline2/jw_player/expressinstall.swf');
youjoomla.setAttribute('xiRedirectUrl', 'http://www.youjoomla.com');
youjoomla.write('youjoomla_videos');
});
</script>
Can you help me with this. I'd love to be able to use this.

OK, my problem is that, somehow my computer will not connect to youtube.com. I really need youtube on my computer because I have an account. My computer resently has just been doing this, and when I put in youtube.com or click on any link that involves bringing you into the youtube website, My mouse starts doing the little timer thing, and I look up top and my blut bar says "Internet not responding" If anyone could help me get connected to youtube, and/or tell me why this is happening, please do so!
Thx!

PS: my e-mail is Shelby_bocco@yahoo.com or Sstands4cute@gmail.com

I am happy to say that 4.3 fixes this problem for me! Thanks JW and the posters here.

I had to get the player.swf as well as the yt.swf file. In case anyone is wondering, I got it from here >> http://developer.longtailvideo.com/trac/browser/trunk/as3

I don't have a home computer so how can i get an Email address and register for web sights

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic).

More information about formatting options