What to know
The Media Player Widget allows, by default, to play videos stored into the internal Flash memory of an operator panel. By the use of JavaScript it is possible to load the video files also from a removable memory storage device such an USB flash drive or an SD card.
The same method allows to load the video files from any folder of a PC when the JMobile PC runtime is used.
The sample application, described in the What to do section and available for the download at the bottom of this page plays an avi file saved on an external USB drive plugged on an operator panel.
Note: the Media Player widget is supported only by eTOP500/600 serie operator panels with 1Ghz ARM Cpu, and JMobile PC Runtime.
What to do
These are the steps required to play a video loaded from an external storage memory device:
- Add to the page a MediaPlayer widget without configure it.
- Execute a JavaScript code, the code configures the MediaPlayer widget to load the desired video file.
In this specific example the JavaScript code that is executed by clicking on the “Play” button, the code determines the storage path of the files to be played and the playlist to be executed.
Below the JavaScript code executed on OnMouseClick event of the play button:
function BtnStd5_ButtonWgt_onMouseClick(me, eventInfo) {
var mediawgt = page.getWidget(“MediaPlayerWgt2”);
// Retrieve the MediaPlayer widget from the page. the widget name
// “MediaPlayerWgt2” information is reported into the “ID” property of the widget,
// that can be found into the Property pane when the widget is selected.
mediawgt.mediapath = “/USBMemory/screensaver1.avi”;
// Define the path to the Media file saved on USB key.
// On an operator panel the path for USB flash drive is /USBMemory/… while the path
// for the use of an SD card is /Storage Card/… On JMobile PC runtime provide
// the path where the video is stored into the PC,
// for exampleC:\Users\Public\Videos\Sample Videos\…
mediawgt.setProperty(“medialist”, “/USBMemory/screensaver1.avi”);
// Set the “medialist” property of MediaPlayer widget
}
To test the application copy the screensaver1.avi file that can be downloaded at the bottom of this page on a USB flash drive and plug it to the panel.
Once downloaded the application on the operator panel click the Play button to reproduce the media.
Note: the target device of this example is an eTOP500 series panel, if you are willing to test the application on a PC with the simulator integrated in JMobile Studio, put the attached “screensaver1.avi” file under the path: C:\USBMemory.
JMobile Studio
eTop500/600 serie operator panels with UN30 1Ghz ARM CPU, JMobile PC runtime
screensaver1.avi
Video_on_USB.zip