内に含ま
その他のドキュメント
サポート リソース
| PDF 文書ファイルをダウンロードする
- CHAPTER 2
Sun MediaCenter Java Client for Sun Workstations
-
- This chapter describes the Sun MediaCenter Java client software for Sun workstations. It describes the Java applet that you can use to display video content from a Sun MediaCenter server in a Java-capable web browser or in standalone mode.
2.1....Overview
- The Sun MediaCenter Java client allows you to use a Java applet to display video content from a Sun MediaCenter server in a web browser window on a client system. The Java applet, named SunMediaCenterPlayer, is an applet that uses Java class libraries to implement a simple video player on the client system. FIGURE 2-1 shows the transfer of video data from a Sun MediaCenter server to the video player applet in a client's browser.

FIGURE 2-1
- The Sun MediaCenter server delivers MPEG bit streams to clients at a constant bit rate. Loading video content onto the Sun MediaCenter server is described in the Sun MediaCenter Server Administrator's Guide, which is available on Sun's web site, at:
-
http://www.sun.com/products-n-solutions/hw/servers/smc_external.html
|
-
Note - While the Sun MediaCenter server supports MPEG-1 and MPEG-2 formats, the video content that is played in the client applet must be in MPEG-1 (MPEG1SYS) format. The decode and display software used by the applet does not support MPEG-2 streams.
-
FIGURE 2-2 shows an example of a web browser with the video player applet.

FIGURE 2-2
- Along with the window that contains the video content, the applet displays status and control bars that allow you to control the playing of the video stream. The Titles button displays a pop-up window that allows you to browse a list of titles on a specified Sun MediaCenter server. An example pop-up window is shown in FIGURE 2-3.

FIGURE 2-3
- The buttons at the upper right of the Titles pop-up toggle between Normal and Multicast. Most often you play a "normal" stream, that is, unicast; server to a single client. The Sun MediaCenter server is also capable of delivering, and the Java client capable of receiving, multicast streams. Playing multicast streams is discussed in Section 2.5, "Multicasting," on page 2-8.
2.1.1...Standalone Player Application
- You can also run the Java client software as a standalone video player that does not use a browser. In this configuration, video content from a Sun MediaCenter server is displayed in a window, as shown in FIGURE 2-4. Status and control bars are similar to those displayed with the applet.

FIGURE 2-4
2.1.2...Client Components
- The Java client software includes the following components:
-
- The video player applet SunMediaCenterPlayer.
- A program called MpegExpert (MPX) that decodes and displays MPEG-1 format video content.
- Java class libraries and a Solaris shared library to run the MPX program so that it displays inside an applet.
- Java class libraries to communicate with a Sun MediaCenter server using the Media Stream Manager (MSM) RPC protocol.
- Sample HTML files.
- A shell script that sets the environment variables to run the applet with the a Java-capable browser.
2.2....Client Requirements
- This section describes the hardware and software required to run the client software.
2.2.1...Hardware
- The client software is a CPU-intensive application that places a significant demand on your hardware resources. Sun recommends that you run the client software on an UltraSPARC(TM) machine with 64 MB of RAM and a Fast Frame Buffer (FFB). Toward the lower end of acceptability is a SPARCstation 10 with 64 MB. With less powerful machines, you run the risk of not being able to decode and display video quickly enough, with the result being jittery video and choppy audio.
-
Note - The MpegExpert software, used for MPEG-1 decoding, has special optimization to improve performance on 24-bit frame buffers.
- Network bandwidth between the client and the video server must be able to support aggregate video streams. The link between the server and the client machines should be at minimum 10 Mbs switched Ethernet, or Fast Ethernet.
2.2.2...Software
- The client workstation must have Solaris version 2.4 or later installed.
-
Note - The target operating environment for this release of the Java client is Solaris 2.6. With this release, you are assured of the correct environment for the Java client.
- The pkgadd installation script looks for a Java-capable web browser, such as HotJava(TM) or Netscape. It also looks for the Java Developer's Kit (JDK). If the script does not find the JDK, it installs it. If you want, you can download the JDK from the www.javasoft.com web page.
2.3....Installing the Client Software
- You install the Sun MediaCenter One software using the pkgadd program. The installation procedure is described in the manual Vendor Value-Added Software, which accompanies the Solaris 2.6 Supplements CD.
- The default installation directory is /opt/SUNWsmsjc, with the subdirectories: /bin, /classes, and /lib. When installation is complete, you can play videos from any Sun MediaCenter server, including a Sun machine running Sun MediaCenter One software.
2.4....Running the Client Software
- The scripts SMChotjava and SMCnetscape in the /opt/SUNWsmsjc/bin directory set the environment variables needed by the applet and launches a Java-capable browser. For example:
-
host% /opt/SUNWsmsjc/bin/SMCnetscape /opt/SUNWsmsjc/demo/player.html
|
- The preceding command launches the Netscape browser with an applet invoked with the parameters contained in the file player.html. (SMChotjava invokes the HotJava browser.) You receive a browser window such as shown the one shown in FIGURE 2-2 on page 2-3. The Titles pop-up window, shown in FIGURE 2-3, allows you to specify a Sun MediaCenter server on your site; enter the server name and
- either press Return or click on the Connect button. The list of titles available on the server then displays. Select a title to play in the applet by double-clicking on a title name or by selecting a title, then clicking on the Open & Play button.
- The SMCnetscape and SMChotjava script accepts command-line options, which correspond to the applet parameters described in Section 2.8.1, "Applet-Specific Parameters," on page 2-13. You can, for example, invoke SMChotjava as follows:
-
host% /opt/SUNWsmsjc/bin/SMChotjava host=smc_server_one title=spartacus
|
- The script SMCplayer in the /opt/SUNWsmsjc/bin directory runs the SunMediaCenterPlayer applet as a standalone video player that does not use a browser. For example:
-
host% /opt/SUNWsmsjc/bin/SMCplayer host=smc_server_one title=spartacus
|
- The SMCplayer script accepts command-line arguments that correspond to the applet-specific parameters described in Section 2.8.1, "Applet-Specific Parameters."
2.5....Multicasting
- The Java client enables you to receive a multicast video stream from a Sun MediaCenter server. A multicast stream is one that is sent to a special IP address that is listened to by multiple receivers. The receiving of a multicast stream presumes you know the multicast address (IP address and port number) to which the stream is sent.
- To receive a multicast stream, click on the Multicast button in Sun MediaCenter Titles pop-up. You receive the window shown in FIGURE 2-5.

FIGURE 2-5
- In the Multicast window, you have two ways of tuning into a multicast stream:
-
- Enter the name of a Sun MediaCenter server and press Return or click on Connect. You receive a list of titles that are being multicast from that server (if any).
- Enter the multicast IP address and port number, and click on Connect. In the title list display area, you receive the name of the multicast title available at the address you specified.
- In the title list, the "Playlist?" heading (see FIGURE 2-5) indicates whether a title is part of a set of titles called a playlist. If a title is in a playlist, under "Multicast Stream", the window displays the first title in the playlist, regardless of which title in the playlist is currently playing.
- To play a multicast title, in the title list display area, select a title and click on Open to load the stream or Open & Play to load the stream and start playback. You receive the window shown in FIGURE 2-6.

FIGURE 2-6
2.6....Admin Tool
- The Java client is shipped with an Admin tool, intended for trained technical personnel. You invoke the tool as follows:
-
host% /opt/SUNWsmsjc/bin/SMCnetscape /opt/SUNWsmsjc/demo/admin.html
|
- After entering the preceding command, you receive the window shown in FIGURE 2-7.

FIGURE 2-7
- The Admin tool enables you to view details of a stream that you are playing. It also allows you to send a stream from a Sun MediaCenter server to a third-party client. You do this by specifying an address, of the form spelled out the Sun MediaCenter Server Programmer's Guide, in the Address: field, then clicking on New Stream. Consistent with this feature, you can start a multicast stream on a local or remote server by connecting to a server and specifying a multicast address.
2.7....Environment Variables Used by Applet
- The scripts that invoke the browser-based and standalone video applications make the following changes to the PATH, LD_LIBRARY_PATH, and CLASSPATH environment variables:
-
PATH=/opt/SUNWsmsjc/bin:${PATH}
LD_LIBRARY_PATH=/opt/SUNWsmsjc/lib:${LD_LIBRARY_PATH}
CLASSPATH=/opt/SUNWsmsjc/classes:${CLASSPATH}
|
- These environment variable modifications have effect only in the context of the Java client scripts and the web browser invoked by the SMChotjava and SMCnetscape scripts.
2.8....SunMediaCenterPlayer Applet
- The video player applet, SunMediaCenterPlayer, uses the Java class libraries to play titles on the Sun MediaCenter server. The applet has required applet attributes, as well as optional applet-specific parameters.
- The syntax for the applet code is shown below:
-
<applet code="SunMediaCenterPlayer.class" width=width height=height>
<param name=host value="hostname"
<param name=title value="title"
<param name=parameter value="parameter_value">
...
</applet>
|
- The required applet attribute code is set to the name of the file that contains the main class of the applet, in this case it is SunMediaCenterPlayer.class. The applet attributes width and height are the dimensions, in pixels, of the applet. The applet-specific parameters are described in the next section.
- If you use only the browser-based and standalone applications invoked by SMChotjava, SMCnetscape, and SMCplayer, you need not be concerned with the applet parameters. These parameters are of interest to those who want to modify HTML files that invoke the SunMediaCenterPlayer applet.
2.8.1...Applet-Specific Parameters
- This section describes applet-specific parameters.
-
-
host
- The name of the Sun MediaCenter server. This value can be a hostname or an IP address. If this parameter is not specified or if the server specified cannot be accessed, no video content is displayed in the applet. Click the Titles button to specify a different Sun MediaCenter server.
-
-
title
- The name of a title to play. The title name is case-sensitive. If this parameter is not specified or if the title specified cannot be played, no video content is displayed in the applet. Click the Titles button to list the titles that are available for playback on a Sun MediaCenter server.
-
-
start
- The offset from the start of the title to begin the playing of the video content. The value for this parameter can be in one of the following forms:
-
-
hours:minutes:seconds.hundredths_of_a_second (for example, "1:45:15.25" means 1 hour, 45 minutes, 15.25 seconds)
-
minutes:seconds (for example, "10:52" means 10 minutes, 52 seconds)
-
seconds (for example, "10" means 10 seconds)
- By default, a value of "0" is assumed, meaning start at the beginning of the title.
-
-
duration
- The duration of the playing of the video content. The value for this parameter can be in one of the following forms:
-
-
hours:minutes:seconds.hundredths_of_a_second (for example, "1:45:15.25" means 1 hour, 45 minutes, 15.25 seconds)
-
minutes:seconds (for example, "10:52" means 10 minutes, 52 seconds)
-
seconds (for example, "10" means 10 seconds)
- By default, a value of "0" is assumed, meaning play to the end of the title. You can use the smc_ls utility to list the normal play time (NPT) for each title that is available for playback on a Sun MediaCenter server.
-
-
loop
- Specifies whether the content is played continuously. A value of "true" means play the specified content in a loop. Note that this value only affects the initial state of the content; you can click the Loop button in the applet control bar to toggle continuous play off or on. The default value is "false" (if you do not specify this parameter, content is not played continuously).
-
-
autoplay
- Specifies whether the content starts playing automatically in the applet. A value of "true" causes the content to play without user intervention. A value of "false" means that the client user must explicitly start the playing of the content, for example, by clicking the Play button in the control bar of the applet. The default value is "true" (if you do not specify this parameter, content starts playing automatically).
-
-
img
The URL of an image to be displayed when content is not being played. For
example, you can display a logo in the applet.
showStatus
- Displays a status bar beneath the applet that shows the title being played, the speed of the play (if trick play is available for the content), the current position of the content being played, and the duration of the play. A value of "true" displays this status bar, while a value of "false" causes the bar not to be displayed. The default value is "true" (if you do not specify this parameter, the status bar is displayed). For multicast streams, showStatus controls the status bar, as it does for unicast streams. However, the status bar for the multicast display contains only the multicast address at which the stream is being received.
-
-
showControl
- Displays a control bar beneath the applet that allows you to pause or play the content, change the speed of the play, or change the current position of the content being played. A value of "true" displays this control bar, while a value of "false" causes the bar not to be displayed. The default value is "true" (if you do not specify this parameter, the control bar is displayed). For multicast streams, showControl controls whether buttons for starting and pausing the display of the stream are displayed.
-
-
showOptions
- Displays a control bar beneath the applet that allows you to turn mute on or off, turn continuous play of the content on or off, and display the Titles pop-up window. A value of "true" displays this control bar, while a value of "false"
- causes the bar not to be displayed. The default value is "true" (if you do not specify this parameter, the control bar is displayed). For multicast streams, showOptions controls whether the button for muting or unmuting the audio output is displayed.
-
-
showTitle
Either true or false (default is true). Determines whether to display the titles
button--the button that brings up the content browser.
multicast
- Displays a multicast MPEG stream in the applet. This value must be a multicast address, which is an IP address in the form
-
multicast_address:multicast_port_number. If you use this parameter, then you should not specify the host or title parameters; values defined for the host and title parameters are ignored.
-
-
cc_data
The URL of a closed caption data file. The closed caption data file is an ASCII file
containing the captions that are inserted in the video content.
cc_index
- The URL of a closed caption index file. The closed caption index file is used for the synchronization of the closed captions (contained in the data file described above) with the video playback. The index file consists of a series of 16-byte records. Each record contains a 64-bit nanosecond timestamp; a 32-bit file offset, in bytes; and 32 bits of zero. The record maps a caption (pointed to by the file offset) to a point in a video clip (expressed by the timestamp). Time zero represents the beginning of the clip.
- Note that you must use the SunTuner(TM) product, in conjunction with the encoding software available from the ISG internal web page, to create the closed caption data and index files.
2.8.2...Examples
- The following applet code plays the title "Just_in_Time" on the server videostar:
-
<applet code="SunMediaCenterPlayer.class" width=704 height=530>
<param name=host value="videostar">
<param name=title value="Just_in_Time">
</applet>
|
-
Note - As described previously, the parameters for displaying the status and control bars do not have to be explicitly specified. The bars appear in the applet by default.
- The following applet code plays the title "solemio" on the server babysms in a small applet. The title plays only when the user starts the play. An image is displayed when a title is not playing.
-
<applet code="SunMediaCenterPlayer.class" width=352 height=290>
<param name=host value="babysms">
<param name=title value="solemio">
<param name=img value="solemio.gif">
<param name=autoplay value="0">
</applet>
|
- The following applet code plays repeatedly the second ten seconds of the title "cat" on the server babysms:
-
<applet code="SunMediaCenterPlayer.class" width=704 height=530>
<param name=host value="babysms">
<param name=title value="cat">
<param name=start value="10">
<param name=duration value="10">
<param name=loop value="true">
</applet>
|
- The following applet code plays content from a multicast stream at address 224.0.0.2 on UDP port 50000:
-
<applet code="SunMediaCenterPlayer.class" width=704 height=530>
<param name=multicast value="224.0.0.2:50000">
</applet>
|
2.9....Troubleshooting
- If you plan to play the SunMediaCenterPlayer applet within a browser, use of the SMChotjava or SMCnetscape script to launch the browser eliminates the possibility of a number of problems, as the script sets the necessary environment variables. If you do not use one of the browser scripts and the applet fails to start up
- within a browser, make sure that the browser's Java classes are available. The classes must either be visible from the CLASSPATH environment variable or have been copied to an appropriate location when the browser was installed. See your browser documentation for more information.
- If the progress slider in the video player moves, but the video does not appear, MpegExpert (MPX) is stopping for some reason. Run MPX by itself with the command mpx to get more information about configuration problems.
- The most common problem that MPX has is that it cannot open /dev/audio or / dev/fb. Enter the following commands:
-
host% touch /dev/audio
host% touch /dev/fb
|
- If you do not have write access to /dev/audio and /dev/fb, have your system administrator configure your system so that you do.
- On rare occasions, the MPX process may be left running after the applet has terminated. As superuser, use the ps command to determine the process ID of MPX, then use the kill command to stop the MPX process. For example:
-
host# ps -ef | grep mpx
22029 ? S 6:43 install_directory/bin/mpx
9316 p5 S 0:00 grep mpx
host# kill 22029
|
|
|