Forum

How can I use video(image) with USB?

Hello community,

I have a question during the development. It's how can I use video with USB.

there is a few question

  1. How can I load and use video from a connected USB?
  2. How can I send a video from my smartphone to USB connected to my TV, and is there a way to send the video to my TV via FTP?

Thanks.

Hi @1114, welcome to the forum!

If your questions is related to Hackathon, please use 'Hackathon' category.

Thanks.

Below steps to be followed for accessing the video file present in USB.

  1. Create a usb folder inside root
    mkdir /usb
  2. Mount external device node of connected device to the created usb folder
    eg : mount /dev/sda1 /usb

So with the above commands, when you access the usb folder via /usb/ ,you can see the contents present in the USB connected

Below is just an example to play and load any file present in the USB device connected:

  1. Run below command in the terminal after connecting board and note down the windowId :
    /usr/sbin/lsm_connector_exporter

  2. Open a new terminal and execute below commands:

  • Load the media pipeline:

luna-send -n 1 -f luna://com.webos.media/load '{"uri":"file:///usb/trailer.mp4", "type":"media", "payload":{"option":{"appId":"com.webos.app.mediaevents-test", "windowId":"_Window_Id_1","videoDisplayMode":"Textured"}}}'

Output:
root@raspberrypi4:/var/rootdirs/home/root# luna-send -n 1 -f luna://com.webos.media/load '{"uri":"file:///usb/trailer.mp4", "type":"media", "payload":{"option":{"appId"
:"com.webos.app.mediaevents-test", "windowId":"_Window_Id_1","videoDisplayMode":"Textured"}}}'
{
"errorCode": 0,
"returnValue": true,
"errorText": "No Error",
"mediaId": "_okPmSuy88gWkaY"
}
root@raspberrypi4:/var/rootdirs/home/root#

  • Play the pipeline with the mediaId recieved in the above load command:

luna-send -n 1 luna://com.webos.media/play '{"mediaId":"_CLrxCZpYpmFKmJ"}'
Output:
root@raspberrypi4:/var/rootdirs/home/root# luna-send -n 1 luna://com.webos.media/play '{"mediaId":"_CLrxCZpYpmFKmJ"}'
{"errorCode":0,"returnValue":true,"errorText":"No Error","mediaId":"_okPmSuy88gWkaY"}
root@raspberrypi4:/var/rootdirs/home/root#

First thank you for your reply.

There's something I forgot when I asked a question. about Implementation Environment.

So do you happen to know how to load images from usb to TV through JavaScript code from visual studio code?(With the USB plugged into the TV)

i think transferring videos can be done with flash drives, which are small memory disks that plug into a USB drive.