You can use JavaScript with the RealPlayer G2 Netscape plug-in with the following browsers:
![]() |
Additional Information |
---|
RealSystem G2 Production Guide available at http:// service.real.com/help/library/index.html explains the basics of embedding a presentation with the Netscape plug-in. |
To refer to an embedded instance with JavaScript, you include a NAME
parameter in the <EMBED>
tag:
<EMBED NAME=vid
SRC="..." WIDTH=300 HEIGHT=134>
You can then refer to the instance through a JavaScript command such as this:
<Input Type="button" Value="play" onClick="document.vid.DoPlay()">
To extend RealPlayer's Netscape plug-in functionality with JavaScript, you first embed the source file in an HTML page with the <EMBED>
tag:
<EMBED NAME=javademo
SRC="demo.rpm"
WIDTH=220 HEIGHT=180
CONSOLE=one
CONTROLS=ImageWindow
BACKGROUNDCOLOR=white
CENTER=true
>
In the <EMBED>
tag, the NAME
parameter provides the name used by the JavaScript functions. For JavaScript to function with RealPlayer, the <EMBED>
tag must not contain the parameter NOJAVA=true
. That parameter prevents the browser's Java Virtual Machine from starting up.
You can then use JavaScript to issue RealPlayer commands to control the embedded presentation. The following example shows a simple form that provides a Play, Pause, and Stop button for the embedded presentation. Click here to see this presentation.
<FORM>
<INPUT TYPE="button" VALUE="Play" onClick="document.javademo.DoPlay()">
<INPUT TYPE="button" VALUE="Pause" onClick="document.javademo.DoPause()">
<INPUT TYPE="button" VALUE="Stop" onClick="document.javademo.DoStop()">
</FORM>
![]() |
Additional Information |
---|
The section "Methods" lists the RealPlayer methods. |
You can use the AUTOGOTOURL
parameter in the <EMBED>
tag to determine how URLs in the presentation are handled. The default value of true applies if you leave the parameter out. In this case any URL embedded in the presentation goes to the browser. If you set this parameter to false, RealPlayer sends the URL to the Java applet or application with the OnGotoURL()
call.
![]() |
Note |
---|
The SetAutoGoToURL() method can override the
AUTOGOTOURL parameter. AUTOGOTOURL is not compatible
with the RealPlayer 5.0 Netscape plug-in, however, so
use SetAutoGoToURL() when planning backwards-
compatibility.
|
The PREFETCH
parameter causes RealPlayer G2 to get the stream description information before the stream starts. You can use this to find out the size and width of an embedded clip, for example, then dynamically create the <EMBED>
tag for the image window, using the clip's native size for the WIDTH
and HEIGHT
parameters. To do this, you would embed a control, such as the default control panel, and set PREFETCH
to true:
<EMBED NAME=console
SRC="demo.rpm"
WIDTH=400 HEIGHT=100
CONSOLE=one
CONTROLS=All
PREFETCH=true
>
The control fetches the stream information, then responds with the callback OnPreFetchComplete()
. You next use GetClipWidth()
and GetClipHeight()
to determine the native size of the image window. Through a means such as DHTML, you can then create the image window control. If the width and height were 320 by 240, respectively, you could generate an <EMBED>
tag like the following:
<EMBED NAME=image
SRC="demo.rpm"
WIDTH=320 HEIGHT=240
CONSOLE=one
CONTROLS=ImageWindow
>
When using JavaScript and the Netscape plug-in, you use LiveConnect to receive callbacks. LiveConnect is described at http://home.netscape.com/navigator/v3.0/liveconnect.html. The java directory of this manual contains callback.java, which is a sample Java class used to create a Java callback object. You can modify this class as necessary to get notifications from RealPlayer's RMObserver or RAObserver interface, both of which are included in the rpcl3260.zip file installed in the RealPlayer folder:
RMObserver is a Java interface for events coming from RealPlayer G2 (but not RealPlayer 5.0). Any object implementing this interface may register itself into RealPlayer G2 to get a large set of notifications. To see how this is done, view the adviseG2() function in RAPlayer.java, which is included in the ZIP file.
RAObserver is a Java interface for events coming from RealPlayer 5.0. Any object implementing this interface may register itself into RealPlayer G2 or 5.0 to get a small set of notifications. To see how this is done, view the advise() function in RAPlayer.java, which is included in the ZIP file.
![]() |
Additional Information |
---|
The section "CallBack Methods" lists the RealPlayer callback events. |