Play a video file on the device from Overlay


Questions ForumCategory: Video Kiosk - AndroidPlay a video file on the device from Overlay
seantheproducer asked 9 months ago

I’ve created an overlay and want to play videos stored locally on the device when I tap the relevant picture.

The pictures associated with each video are in the background layer. I’ve then added a transparent overlay with just a home icon in the corner.

I’d like the overlay to remain the top layer so you can press the home button at any tome to stop the video and return to the main screen.

My first issue is I can’t get the videos to play. If I have the following URL:
storage/emulated/0/VideoKiosk/media/overdrive.mp4
…it just goes to a white screen.

If I add file:// to the URL I get Web page not available / invalid URL.

Here’s my XML for the first item:

<?xml version=”1.0″ encoding=”UTF-8″?>
<hotspots>

<hotspot>

<url>file://storage/emulated/0/VideoKiosk/media/overdrive.mp4</url>

<rect>

<top>0.22</top>
<left>0.03</left>
<bottom>0.48</bottom>
<right>0.33</right>

</rect>

<keycode>1</keycode>
<interactionkey>overdrive</interactionkey>

</hotspot>

</hotspots>

I’d also like the video to play under the overlay so you can tap a home icon to go back at any time.

Is this possible?

1 Answers
admin Staff answered 9 months ago

You need to change the URL to be an HTML file.

For example, with a directory layout like this:

videokiosk
– media
– – mainvideo.mp4
– html
– – subvideo.html
– – subvideo.mp4

The URL for the hotspot would be:
file://storage/emulated/0/videokiosk/html/subvideo.html

The subvideo.html file would contain the html code to play the subvideo.mp4.

Now that you have an HTML file playing the video, you can overlay a button on that video and use the Javascript method window.VideoKiosk.closeWebView(); to exit from the HTML file back to the main video loop.

So yes, it can all be done, but you need to use HTML / Javascript to do what you want to do.