Configuring the Media Player
Technical Note 5076
Applicable Model(s)
HMI5000 X Series
Title
Configuring the Media Player
Date
10/11/2010
Rev
00
P/N
0907-5076
Summary
The Media Player Object is used to play a media file on the HMI screen. The media file is stored on a USB flash drive or SD card connected to the HMI. The media player supports the following formats: avi, flv, mov, mp4, mpg/mpeg, wav, wmv. The recommended video resolution is 640 x 480, and the mp4 file format provided the best results in our testing.
This document explains how to configure the Media Player Object.
NOTE: The Media Player is available only on X series models.
Solution
To add video to a window in EasyBuilder-5000, from the Objects menu, click Media Player. The Media Player Object’s Properties dialog window appears.
The Media Player provides two options for playback control: manual and automatic. Automatic video playback begins playing a video immediately when the window containing the media player object is displayed. To enable Automatic playback in the Media Player Object’s Properties window, un-check the Enable option under the Control address section.
To enable manual video control in the Media Player Object’s Properties window, check the Enable box under the Control address section. Enabling the control address provides control for functions such as play, pause, stop, seek, zoom, and volume adjustment. These control functions are managed by setting the parameter 1 and 2 register values and writing the command value to the command register. The Media Player control address defines a series of registers used to manipulate the various video playback control functions.
The command register address is defined on the General tab in the Media Player Object’s Properties window. The subsequent register addresses contain additional parameters and video playback information as indicated below.
Setting | Description | ||
Control address | Enable control address | Enable When enabled, the Control address and subsequent registers controls the operation of the Media Player. Disable Removes manual control of video play operation. The system will start to play the first video at designated folder when the window is opened. | |
Command | Users set this address to control the operation of media player. Command (control address + 0) | ||
Parameter 1 | Parameter 1 for control operation. Parameter 1 (control address + 1) | ||
Parameter 2 | Parameter 2 for control operation Parameter 2 (control address + 2) | ||
Status | The system will turn bits ON when state changes or malfunctions. Status (control address + 3) | ||
File index | The register that contains the index number of the file being played. The system will write the file index value when the video begins. File index (control address + 4) | ||
Start time | The register that contains the time index (seconds) at which to start the file. The default is zero. Start time (control address + 5) | ||
End time | The register that contains the time index (seconds) at which to end the file. End time (control address + 6) | ||
Video playing time | Update video playing time | Enable When checked, the Media Player will write the elapsed time of the media file into the Playing Time register. | |
Update period | Defines how often the Media Player writes the elapsed time of the media file into the Playing Time register. (1 to 60 seconds) | ||
Playing time | Update the video elapsed time periodically. (seconds) Playing time (control address + 7) | ||
Video file store location | SD | Play video files in SD card. | |
USB1 | Play video files in USB1. | ||
USB2 | Play video files in USB2. | ||
Folder name | The folder where the video files are stored. Files must be located in a folder (e.g. “Video”). Video files cannot be in root directory. Note: 1. [Folder name] cannot be empty. 2. [Folder name] cannot include /\:*?”<>|. | ||
Attribute | Auto. repeat | When finish playing a video file, the system will automatically play the next video. e.g. > > … > | |
Background | Select the background color of the object. |
The following table lists the functions and their corresponding values that must be written into the command and parameter registers to enable the various control functions. For example, to play file 2, write a 2 in the parameter 1 register and a 1 in the command register.
Media Player Commands
Command | Parameter 1 | Parameter 2 | Function |
1 | 0, 1, 2, … | 0 | Plays the file indicated by Parameter 1, where 0 is the first file in the specified folder, 1 is the second file, etc. Files are sorted in alphabetical order. |
2 | 0 | 0 | Play the previous file. Files are sorted in alphabetical order. |
3 | 0 | 0 | Play the next file. Files are sorted in alphabetical order. |
4 | 0 | 0 | Play / Pause toggle. |
5 | 0 | 0 | Stop playing and close the file. |
6 | 1 to n-1 | 0 | Start playing the file at the point specified by Parameter 1, where n is the length of the file in seconds. |
7 | 1 to n-1 | 0 | Jump ahead to the point in the file specified by Parameter 1, where n is the length of the file in seconds. |
8 | 1 to n-1 | 0 | Jump back to the point in the file specified by Parameter 1, where n is the length of the file in seconds. |
9 | 0 – 128 | 0 | Volume level. |
10 | 0 – 16 | 0 | Zoom level. 0 causes the video to fit the display object size; non-zero values adjust the magnification in 25% increments: 1 = 25%, 2 = 50%, 16 = 400%. |
Select the storage device (SD card, USB1, or USB2), and indicate the folder name on the storage device containing the video file. Specify the folder on the storage device where the media file(s) reside in the Folder name: field. The root folder is not allowed; and only one level is supported. For example, an entry of “video” specifies the folder “video” on the USB device, and is allowed. An entry of “video\files” specifies the folder “files” under the folder “video,” and is not allowed.
Click the Preview tab to load the media file and view the file. If the file plays in the Preview tab, it will play in the simulator and in the HMI.
Two sample Media Player projects are available in the Support Center on our Website. The BasicMediaPlayer project is configured without the control function enabled, and the MediaPlayerControl project incorporates many of the control features.