# Start video on hdmi with node red

**URL:** <https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228>\
**Category:** General\
**Created:** [15 December 2021 09:53 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228 "2021-12-15T09:53:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![azertym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/azertym/32/52108_2.png) [@azertym](https://discourse.nodered.org/u/azertym)\
**Post date:** [15 December 2021 09:53 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/1 "2021-12-15T09:53:25Z")

</div>

Hi all,  
I want test something with node red and one raspberry pi.

I use HC SR04 (ultra sonic sensor). If my SR04 is under 10 i want play a video.

Si for this i use the node RPI-SRF and i made a little function.

```auto
if(msg.payload < 10){
    msg.payload = "PLAYVIDEO"
}
return msg;

```

after this node I put an exec mode with this command "mpg123 /home/pi/Desktop/flip2.mov"  
But in debug node i've this msg.payload "".

So question, How to play a vidéo in fullscreen when the SR04 is under 10cm ?

```auto
[
    {
        "id": "e63e6f037fea2e7f",
        "type": "rpi-srf",
        "z": "0a43e3503ec04468",
        "name": "Capteur de proximité",
        "topic": "SRF",
        "pulse": "0.5",
        "pins": "35,37",
        "precision": "0",
        "x": 2990,
        "y": 1280,
        "wires": [
            [
                "72c228dd03b00f70"
            ]
        ]
    },
    {
        "id": "72c228dd03b00f70",
        "type": "function",
        "z": "0a43e3503ec04468",
        "name": "Sensibilité capteur",
        "func": "if(msg.payload < 10){\n msg.payload = \"PLAYVIDEO\"\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 3300,
        "y": 1300,
        "wires": [
            [
                "f865e04384c37cf0",
                "579d56c98f95ef55"
            ]
        ]
    },
    {
        "id": "f865e04384c37cf0",
        "type": "exec",
        "z": "0a43e3503ec04468",
        "command": "mpg123 /home/pi/Desktop/flip2.mov",
        "addpay": "payload",
        "append": "VIDEO",
        "useSpawn": "false",
        "timer": "0",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 3670,
        "y": 1320,
        "wires": [
            [
                "05d9470753db434d"
            ],
            [],
            [
                "7a66713f34f14a28"
            ]
        ]
    },
    {
        "id": "05d9470753db434d",
        "type": "debug",
        "z": "0a43e3503ec04468",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 4140,
        "y": 1280,
        "wires": []
    },
    {
        "id": "7a66713f34f14a28",
        "type": "debug",
        "z": "0a43e3503ec04468",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 4070,
        "y": 1400,
        "wires": []
    },
    {
        "id": "579d56c98f95ef55",
        "type": "debug",
        "z": "0a43e3503ec04468",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 3540,
        "y": 1100,
        "wires": []
    }
]

```

thanks in advance

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [15 December 2021 10:41 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/2 "2021-12-15T10:41:38Z")

</div>

I think mpg123 just plays audio??

---

<div class="post-metadata">

**Author:** ![azertym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/azertym/32/52108_2.png) [@azertym](https://discourse.nodered.org/u/azertym)\
**Post date:** [15 December 2021 10:46 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/3 "2021-12-15T10:46:53Z")

</div>

If Mpg123 just play audio, what can i use for this ?

I tried VLC but is not work too..

i've this on my debug node :

```auto
VLC media player 3.0.16 Vetinari
Command Line Interface initialized. Type `help' for help.

```

```auto
Command failed: vlc /home/pi/Desktop/flip2.mov 108 VIDEO
[014e7108] vlcpulse audio output error: PulseAudio server connection failure: Connexion refusÃ©e
[01525478] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[01525478] main interface error: no suitable interface module
[01461b98] main libvlc error: interface "dbus,none" initialization failed
[0150f930] main interface error: no suitable interface module
[01461b98] main libvlc error: interface "globalhotkeys,none" initialization failed
[01461b98] main libvlc: Lancement de vlc avec l'interface par dÃ©faut. Utiliser Â«Â cvlcÂ Â» pour dÃ©marrer VLC sans interface.
error: XDG_RUNTIME_DIR not set in the environment.
[0150f930] skins2 interface error: cannot initialize OSFactory
[0150f930] [cli] lua interface: Listening on host "*console".
vlc: ./interface/vmcs_host/vc_vchi_gencmd.cÂ :160Â :Â vc_vchi_gencmd_init: l'assertion Â«Â success == 0Â Â» a Ã©chouÃ©...

```

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [15 December 2021 11:00 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/4 "2021-12-15T11:00:12Z")

</div>

With VLC it works fine for me to play video on the display

When you run a program from the exec node it does not give access to the display by default. You can try this configuration to give vlc access to your display and check if it works

`export DISPLAY=:0 && vlc /home/pi/Desktop/flip2.mov`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/1/619e4b4cbd9a128f0e90ac7191b3c6201d899cc0.png)

---

<div class="post-metadata">

**Author:** ![azertym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/azertym/32/52108_2.png) [@azertym](https://discourse.nodered.org/u/azertym)\
**Post date:** [15 December 2021 11:04 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/5 "2021-12-15T11:04:50Z")

</div>

Ok, thanks a lot Krambriw,

It's much better, but my video start at each msgpayload received.

I d'ont know why, because i put a condition. Start exec when payload Video it's received...

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [15 December 2021 11:17 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/6 "2021-12-15T11:17:08Z")

</div>

That is another thing you have to solve. Now your video is paying 😉

---

<div class="post-metadata">

**Author:** ![azertym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/azertym/32/52108_2.png) [@azertym](https://discourse.nodered.org/u/azertym)\
**Post date:** [15 December 2021 11:53 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/7 "2021-12-15T11:53:42Z")

</div>

Yes for sure, Thanks a lot Krambriw 😉

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 December 2021 11:54 UTC](https://discourse.nodered.org/t/start-video-on-hdmi-with-node-red/55228/8 "2021-12-29T11:54:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
