Display mp4 video in Vision

I need to display mp4 videos in a Vision client. I don’t see a control in Vision that allows me to do that, so I thought I’d be clever and create a Perspective view to display the videos, and then use a web browser control in Vision to display the view. When I launch the view in my browser, I can see the videos just fine. When I run the Vision project and attempt to display the videos using the Perspective view, the view loads but the videos will not display. I get an error that says “Error Loading Media: File not valid”. The videos that I am attempting to display are stored on a web server, and I’m using Ignition 8.1.7. Any help would be appreciated. Thanks.

The web view component, based on JXBrowser, is limited in what video codecs it supports. I don’t think mp4 is one of them. See this table; I think only the codecs in the Chromium column are supported.

Unfortunately I don’t understand how the technology passes through the layers that I’ve built, but the video player in the Perspective view does actually display the mp4 when just displayed in a browser. What you’re saying is that the web browser control in Vision can not display the mp4, even though the Perspective view that it points to can?

Google, Microsoft, Mozilla, etc… have all paid a large sum of money to MPEG LA (or whoever else) for an unlimited use license to distribute support for these video codecs in their browsers.

The Vision web browser component (and consequently Perspective Workstation), being based on JXBrowser, which is based on Chromium, not Chrome, does not include a license for any of these codecs, and therefore will not be able to play videos encoded with them.

I guess that’s my answer then. So the video player component in Perspective is otherwise licensed? Are there any other options for displaying an mp4 in Vision?

Perspective's video component doesn't have the license - your browser does.

I don't think there's anything available from IA to make this work, but maybe a 3rd party module author? I think @mazeyrat maybe had some kind of module that relied on VLC to play video streams?

got it, that makes sense. thanks for helping out.

Yes, we have a component for vision only.
We finally not using VLC, but a pure java H264 decoder with rtsp and ptz onvif support.
It is restricted to H264 low and main profil and need a powerfull CPU.
For vision a component based on VLCJ could certainly be an interesting alternative

The easiest answer for me was to convert my videos to a different format that would play in Ignition. I just used the web browser control in HTML mode, and bound (part of) the HTML to a dropdown list that contained a list of videos to choose from. Works like a charm.

2 Likes

Hi Jkramer, can you tell us which format did you use for the video file? Thank you.

Hi - wow that's going way back for me. We don't even use that functionality any more, but from what remnants I can still find, I think it was the .ogg file format. I hope that helps.

I just thought I would chime in here since this is a problem I have had and might work for you.

My use case is that we show a safety video to logging truck drivers in a kiosk. Displaying the video full screen with no way to minimize or close early was one of the minor precautions I took to make this tamper resistant. There are more options in VLC stand alone that can lock it down slightly more.

I have this code on a button in a Vision project. The button to proceed does not appear until the “Played” custom property is true.

import subprocess
import sys

def play_video_block_input():
	try:
		# Launch VLC in fullscreen, minimal UI, and exit when done
		p = 'C:\\_IgnInfo\\vlc\\vlc.exe'
		a1 = '--fullscreen'
		a2 = '--qt-minimal-view'
		a3 = '--play-and-exit'
		video = r'C:\\_IgnInfo\\Log Yard Kiosk\\Wrapper Rack Video.mp4'
		args = [p, a1, a2, a3, video]
		bi = subprocess.Popen(args)
		bi.wait()
	finally:
		pass
	event.source.Played = 1

play_video_block_input()

This is still working in 8.3.0.

1 Like