Play Video Files on i.MX 8M Plus
You can upload .mp4
video files to your virtual i.MX 8M Plus board or provide a URL to play videos in a loop. This page contains the following sections that explain the process:
Open the GStreamer Multimedia Application
To open GStreamer:
Create a virtual i.MX 8M Plus board running Yocto Linux version 2.2.0.
Open the Terminal by clicking the second icon in the top-left of the device's display. You may prefer to open the display to a new window by clicking Pop Out towards the top-right.
Run the following command in Terminal to launch GStreamer.
gst-launch-1.0 v4l2src device=/dev/video4 ! waylandsink
After a few seconds, you should see the video player open along with a message that your camera is not enabled.
Open the Camera & Microphone settings under the Sensors tab and enable the sensors.
Play Video Using the Web Interface
The i.MX 8M Plus device supports video playback from your webcam, by uploading a file, or by sharing the video's URL.
Use Your Webcam
To use your webcam:
After you enable the camera and microphone sensors, allow the browser to access your computer's built-in webcam and microphone. (This process will vary depending on your browser.)
Confirm that you can see your computer's sensors appear under CAMERA and MICROPHONE.
You should see your webcam video appear on GStreamer.
Upload a File - Web Interface
To upload a file using the web interface:
After enabling the virtual camera and microphone in the Sensors tab, upload the
.mp4
video file. You do not need to allow the browser to access your local computer's physical camera and microphone.When the upload completes, click PLAY VIDEO. The video should play on GStreamer in a loop.
Link to a URL - Web Interface
To link to a URL using the web interface:
After enabling the camera and microphone in the Sensors tab, enter a URL to a
.mp4
video and click PLAY VIDEO. You do not need to allow the browser to access your local computer's physical camera and microphone.The video should play on GStreamer in a loop.
Play Videos Using API and POST Requests
You can also use the command line to play multimedia files.
Start with GStreamer opened (gst-launch-1.0 v4l2src device=/dev/video4 ! waylandsink
).
Upload a File - API and POST Requests
To upload a file using the AVH API:
Use the AVH API to acquire the device instance.
Upload the
.mp4
file to that instance.const videoImage = await instance.uploadImage('media', $LOCATION_OF_AN_MP4_ON_YOUR_LOCAL_DISK, '$ANY_ARBITRARY_STRING')
Note the
imageId
that is returned.Make a POST request to
/api/v1/instances/${instanceId}/play
with the following body.{
instanceId,
imageId
}Verify that you can see the video playing.
Link to a URL - API and POST Requests
To link to a URL using the AVH API:
Use the AVH API to acquire the device instance.
Make a POST request to
/api/v1/instances/${instanceId}/play
with the video URL in the body.{
instanceId,
url: 'http://null.to/test.mp4'
}Verify that you can see the video playing.