internet.com

Developer Channel

SYMM

Take Control of RealPlayer with JavaScript
by Tim Kennedy
June 19, 2000

If you worked through my previous tutorial on RealNetworks streaming media you have a pretty good feeling on how to work with the format. You know how to encode your digital media, post it on a server, and make it accessible from a Web page. But what if you want to make your streaming video do new tricks?

If your idea of new tricks involves using JavaScript, RealMedia is up to the challenge. RealPlayer includes a number of hooks to make the player obey your commands.

In this tutorial, I will be using JavaScript to create a simple custom interface for my streaming media content. Hopefully you will find these simple steps an inspiration for your further exploration of JavaScript functionality in RealPlayer. One NOTE: Users of RealPlayer for Macintosh have had problems trying to play embedded content when viewing the target Web page with Internet Explorer. If you are a Mac user, and have any such problems with this article please try using Netscape to view the page instead.

Setting Up the <EMBED>
I begin by making some assumptions. I am assuming that you have already converted your digital media to RealMedia and have embedded that content into a Web page. If not, revisit my earlier tutorial on working with RealMedia before beginning.

If you are familiar with basic JavaScript, you know that the scripting language allows you to reference and manipulate objects within the browser document. In a classic rollover, JavaScript allows you to name a graphic, reference that graphic with the script, and change the graphic dynamically when the user rolls their mouse over a link.

Much like setting up a graphic rollover, our first step in hooking into the RealPlayer’s JavaScript power involves naming the plug-in instance. This is done simply by slipping a NAME attribute into the <EMBED> tag:

<EMBED SRC="libertyG2.rpm" NAME="libertyclip" WIDTH="256" HEIGHT="192" CONTROLS="ImageWindow">

In the example above, the <EMBED> tag does little more than display a window with the RealMedia content. To play the content, I would have to click the window and pull up "Play" from the contextual menu. Instead, I will add a few buttons and let JavaScript do the work. Now that we have the RealMedia object named ("libertyclip" in this example) I am ready to hook into that object with JavaScript.


  1 • 23 Next >>
 
The Latest WebDev Tips from DevX

Receive news via our XML/RSS feed
XMLRSS



Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers