Play a video file on the device from Overlay


Questions ForumCategory: Video Kiosk - AndroidPlay a video file on the device from Overlay
seantheproducer asked 1 year 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?

3 Answers
admin Staff answered 1 year 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.

digitalcoleman answered 8 months ago

I followed all these instructions, and the overlay works, and I tested the html page on my computer, but when the overlay tries to run the html page, it says ERR_ACCESS_DENIED. Elsewhere I read that it is an Android app issue?

admin Staff answered 8 months ago

This, as it says, is a permission error. Depending upon the version of Android it can be one of two permissions. The easiest thing to do is:

  1. Uninstall Video Kiosk
  2. Reinstall Video Kiosk
  3. Allow ALL Permission Requests

On modern Android Video Kiosk will automatically take you to the correct system preference for All file access, which is probably the one you did not grant.
There is a video here that shows you how to grant just that permission: