Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Popup window player with javascript interaction


Hi

We currently have a page which allows you to control which track is being played using the Javascript navigation.

Here's our current integration: http://www.skiddle.com/djs/james-ryan/mixes.html

Ideally I'd like to extend this to offer a 'add track to playlist' function, with the player in a *popup window*. That way people can navigate around different profiles, find tracks they like and add it to the popup window, which stays open even if navigating away from the current page

Any ideas?

26 Community Answers

JW Player

User  
1 rated :

@Ben,

I'm working on some demos of popups, both in a new window and in a <div> on the same page.

The basic method is to open a named popup window and then write to that window instead of the main window.

The popup is another complete HTML page with the JS code to add to the playlist. When you initially pop it up, you send it the current playlist. Then as the user adds selections, you write to the playlist in the popup window.

Call this function:
bc.. functionpopUpVideos(popurl,popwidth,popheight,move_x,move_y,aFile)
{
bFile=encodeURIComponent(aFile);
popup=window.open(popurl,'win','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,width='+popwidth+',height='+popheight);
popup.moveTo(move_x,move_y);
self.name="mainWin";

setTimeout("popup.createPlayer(bFile)",750);
}


with something like this (image popup):
bc.. <a href="#" onclick="popUpVideos('popup-1.html', '340', '352', '600', '200', 'another_video.flv'); return false;"><img src="image01_thumb.jpg" alt="Click to open PopUp 1" width="40" height="40" border="0" /></a>


with the existing playlist instead of a single file, then as the user makes selections, call something like this (this is for adding a preroll, poor example, but all I have right now):
bc.. <a href="#" onclick="*popup.*addItem({author:'Jeroen', title:'Video Ad', file:'video.flv', category:'preroll', link:'http://my.domain.com'}, 0); return false;">Add Preroll Before Track 1 [0]</a>


and it will add to the playlist in the popup instead of on the main page.

JW Player

User  
0 rated :

@Ben,

You can see a demo of the methods here: [url=http://willswonders.myip.org:8085/php/basic_popup.html]Basic Popup[/url]

I'm doing some other stuff with that page, so the green buttons are for you, although you are free to click on the other stuff (thumbnails and displayarea) also. :)

JW Player

User  
0 rated :

see my post in the other similar thread:

http://www.jeroenwijering.com/?thread=9269#msg58229

JW Player

User  
0 rated :

In case any newbies would like to know how to open a single FLV video with the player in a new pop-up window here's the simple code.

bc.. <a title="click to watch" ONMOUSEOVER="window.status='Open video';return true" ONFOCUS="window.status='Open video';return true" ONMOUSEOUT="window.status=''" href="JavaScript:void(0)" onClick="window.open('http://www.YOURWEBSITE.com/videos/mediaplayer.swf?file=http://www.YOURWEBSITE.com/videos/VIDEOFILENAME.flv&amp;allowfullscreen=true&amp;height=313&amp;width=400&amp;&amp;id=veneers&amp;searchbar=false&amp;showicons=false&amp;autostart=true&amp;overstretch=fit&amp;backcolor=0x287585&amp;frontcolor=0xFFFFFF&amp;lightcolor=0x000000', 'Window1','left=1,top=1,menubar=0,location=0,status=0,width=400,height=313,toolbar=no,resizable=0');">Open Video</a>




keywords:

open flv file with javascript
play flv only
open in new window
single flv video
flv without html page
no embed video
open flv in popup

JW Player

User  
0 rated :

the code above is not working for me

JW Player

User  
0 rated :

please see the - *http://www.jeroenwijering.com/?item=Javascript_API_Examples*
for examples like this popupwindow - *http://home5.inet.tele.dk/nyboe/flash/mediaplayer4/JW_API_xmpl_7-3-0-0.html*

please note that the above examples all use the swfobject v.2.1 - *http://code.google.com/p/swfobject/*
also note that the javascript api only works online on a server for flash security reasons...

JW Player

User  
0 rated :

I know this comment is way overdue, Silly Rabbits, but thanks for this simple code! It worked perfectly for me and was exactly the solution I was looking for.

JW Player

User  
0 rated :

I tried using Silly Rabbits' popup code and it seems to work great. I have two questions about it though -

1) how can I change the popup window title? Right now its just the path for the player file

2) I keep getting an "Access is Denied" error when I close the popup in IE (not in Firefox)? Everything works fine even in IE, the error just comes up when you close the window and you have to hit 'yes' quite a few times for it to go away. Can I suppress the error message somehow since everything seems to be working correctly?

JW Player

User  
0 rated :

I'm having trouble with the fullscreen function working in the popup code that sillyrabbit posted. when you click on the fullscreen button, nothing happens. Here is an example of the code.

http://www.rc51.info/index.php?page=red-bull-rush-indianapolis

JW Player

User  
0 rated :

Hi - pop up code will not work in Internet Explorer 7 if the user has selected to open popups in a new tab.

www.Homepage-link.to/pirate

JW Player

User  
1 rated :

Thanks Silly Rabbits!!!

JW Player

User  
0 rated :

Thank you silly rabbits! It worked for what I need it for aswell. :) But would you be able to amend the code so that the "full screen" button works with the player? Cheers. :)

JW Player

User  
0 rated :

Just relised "allowfullscreen=true" is actually in that code... unfortunatly it still don't make it work. Oh well... Many thanks for the code though, big help to the headacke I had for a few hours. :D

JW Player

User  
0 rated :

Used this script as welll with the viral player and it worked great.

If anyone has an answer to how to turn on full screen please let me know.

JW Player

User  
0 rated :

This excellent simple piece of code from Silly Rabbits doesn't work with IE8 there is a Javascript error thrown 'Invalid argument' on the line with :

href="JavaScript:void(0)"onClick="window.open('/mediaplayer.swf?file.....

The code works OK with Firefox, Safari & Google Chrome.

Does anyone have any ideas what needs to be changed to make it work with IE8?

JW Player

User  
0 rated :

This nice example from *andersen* does not work with IE8 in Vista or XP but oddly does work with Windows 7

http://home5.inet.tele.dk/nyboe/flash/mediaplayer4/JW_API_xmpl_7-3-0-0.html

Again the code works OK for Firefox, Safari & Google Chrome

JW Player

User  
0 rated :

is there anyway to pop the video once the page has been loaded? i mean on the <body> tag??? anyone?

JW Player

User  
0 rated :

[url=http://www.google.com/search?q=cross+window+scripting]google cross window scripting[/url]

JW Player

User  
0 rated :

It's called Wimpy Player

http://www.wimpyplayer.com/products/wimpy_mp3.html

JW Player

User  
0 rated :

here is the code
bc.. <script language="JavaScript">
<!--
function refreshParent() {
window.opener.location.href = window.opener.location.href;

if (window.opener.progressWindow)

{
window.opener.progressWindow.close()
}
window.close();
}
//-->
</script>



You can download more script buy
*http://Filesharepoint.com*

JW Player

User  
0 rated :

Thanks Silly Rabbits, that works fine! :)
But one thing: The video in the popup seams to laod completely before it starts. This takes some time and is rather annoying.
What do I have to do to let it start immediately and load the rest of the video in the background while it is already playing? Does anyone know that piece of code?
Thanks a lot in advance!

Ethan Feldman

JW Player Support Agent  
1 rated :

@britta – Do you have a link where you are trying to run this?

JW Player

User  
0 rated :

yes, I do, but its my client's website and I don't think I should post the link here :o

But it definitely just doesn't download progressively but load completely before it starts. There is also no dark-grey progress bar, but only the light grey one and then after a rather long time the black progress bar starts.

As in Silly Rabbits suggestion I haven't defined any bufferlength, do you think this could help?

Ethan Feldman

JW Player Support Agent  
0 rated :

email me the link – ethan [at] longtailvideo [dot] com, thanks!

JW Player

User  
0 rated :

done! :)

Ethan Feldman

JW Player Support Agent  
0 rated :

Thanks! :)

This question has received the maximum number of answers.