Go
Not registered? Sign up!

Pause button javascript function, Need Help....

Google Translate
9 posts | return to the JavaScript Interaction forum | get the rss feed for this thread

Dec. 26, 2007james

Hello,

I am new to coding and have been playing around with the media player and saw that it was possible to use javascript to stop / play the selected video.

I copied the entire page from the javascript example and when I try it live, there is no luck.

You can see the page at:

http://www.sumoyo.com/-sfghtog.htm

Would like to also know if you can a mouse over the link to pause?

Appreciate any help.

Dec. 26, 2007andersen

you need to upload the mediaplayer.swf and swfobject.js as well as the playlist to your own site along with sfghtog.htm -
(and change the paths in the page accordingly)
you cannot control a player from another site with the javascript api for flash security reasons!

Dec. 26, 2007james

Hi Andersen,

Thanks for the help and that's why you guys are the experts.

Also wanted to know what would be the only Javascript I would need to keep on this page to have the pauseplay function still work?

Dec. 26, 2007andersen

heres code for a full page with only a play/pause button

<html>
<head>
<script type="text/javascript" src="swfobject.js"></script>

<script type="text/javascript">

function sendEvent(typ,prm) { thisMovie("mpl").sendEvent(typ,prm); };

function thisMovie(movieName) {
if(navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
};
</script>
</head>
<body>
<div id="player"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash</a> to see this Player.</div>
<script type="text/javascript">
var s1 = new SWFObject('mediaplayer.swf','mpl','320','320','8');
s1.addParam("allowfullscreen","true");
s1.addVariable("file","playlist.xml");
s1.addVariable("enablejs","true");
s1.addVariable("javascriptid","mpl");
s1.addVariable("width","320");
s1.addVariable("height","320");
s1.addVariable("displayheight","240");
s1.write('player');
</script>
<a href="javascript:sendEvent('playpause')">Toggle the pause state</a>.
</body>
</html>

Dec. 26, 2007james

Hi Andersen,

This all works great, thank you for your help.

A few additional questions.

Is it possible to have this function only perform a pause function? If so how?

Also if we wanted to set this up as embedded code what would our string need to look like to include the javascript functions?

Greatly appreciate all of your guidance.

Dec. 28, 2007andersen

try use the stop command instead: <a href="javascript:sendEvent('stop')">Stop loading and playing</a> please also checkout the [url=http://www.jeroenwijering.com/extras/wizard.html]wizard[/url]

Mar. 29, 2008pop

ıopıopıo

Oct. 27, 2009Aram

I just use:

my_ns.pause();

inside a function using my moviclip name for the interaction. I know that this isn't javascript, but it works if you have access to the actionscript code of the player.

Oct. 27, 2009Aram

...forgot to mention that this uses the netstream object, where "my_ns" is the name of the netstream.

Add a reaction

You can also return to the category or try this search for related threads.


 

Search the Forums

Go

Support

Support Here are some helpful links to learn more about the JW Player™:

Monetize Your Video

Monetize Your Video Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!

Why Buy a License?

Why Buy a License? If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.