All Collections
Advanced Features
Play Video Files on Virtual i.MX 8M Boards
Play Video Files on Virtual i.MX 8M Boards

Upload videos to your device or provide a URL to play videos in a loop on your virtual i.MX 8M board.

avhsupport avatar
Written by avhsupport
Updated over a week ago

Table of Contents

The virtual iMX8m board supports playing .mp4 video files directly on your device.

You can use either the AVH web interface or a set of API and POST requests.


Open the GStreamer Multimedia Application

  1. Create a virtual iMX8M Arm Cortex Complex board running Yocto Linux OS version 2.2.0.

  2. 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.

  3. Run the following command in Terminal to launch GStreamer.

    gst-launch-1.0 v4l2src device=/dev/video4 ! waylandsink

  4. After a few seconds, you should see the video player open along with a message that your camera is not enabled.

  5. Open the Camera & Microphone settings under the Sensors tab and enable the sensors.


Play Video Using the Web Interface

The iMX8m device supports video playback from your webcam, by uploading a file, or by sharing the video's URL.

Use Your Webcam

  1. 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.)

  2. Confirm that you can see your computer's sensors appear under CAMERA and MICROPHONE.

  3. You should see your webcam video appear on GStreamer.

Upload a File

  1. 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.

  2. When the upload completes, click PLAY VIDEO. The video should play on GStreamer in a loop.

Link to a URL

  1. 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.

  2. 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

  1. Use the AVH API to acquire the device instance.

  2. Upload the .mp4 file to that instance.

    const videoImage = await instance.uploadImage('media', $LOCATION_OF_AN_MP4_ON_YOUR_LOCAL_DISK, '$ANY_ARBITRARY_STRING')

  3. Note the imageId that is returned.

  4. Make a POST request to /api/v1/instances/${instanceId}/play with the following body.

    {
    instanceId,
    imageId
    }

  5. Verify that you can see the video playing.

Link to a URL

  1. Use the AVH API to acquire the device instance.

  2. Make a POST request to /api/v1/instances/${instanceId}/play with the video URL in the body.

    {
    instanceId,
    url: 'http://null.to/test.mp4'
    }

  3. Verify that you can see the video playing.

Did this answer your question?