Kill video loop and restart after delay

Hi all,

To finish my work i need to make a flow with exec node.

I need to launch a vidéo manually, this vidéo play in loop. sometimes, my srf 04 can detect people and i need to kill the loop, play video prox, and restart the loop.

Have you got a good idea to make this ? For the moment i maked this but i've an error :

[
    {
        "id": "d9804431926b90fe",
        "type": "function",
        "z": "1fcfdbf29377b8b1",
        "name": "Sensibilité capteur",
        "func": "var MessageSent = false;\n\n\nif((msg.payload < 10) && (MessageSent == false)){\n    msg.payload = \"PLAY\"\n    MessageSent = true;\n    return [msg, null];\n}\nelse {\n    msg.payload = \"OUT\"\n    return [null, msg];\n}",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1730,
        "y": 2120,
        "wires": [
            [
                "f86d94e5c069e151",
                "7113c94b2fcab982"
            ],
            []
        ]
    },
    {
        "id": "f86d94e5c069e151",
        "type": "exec",
        "z": "1fcfdbf29377b8b1",
        "command": "killall -9 vlc && export DISPLAY=:1 && vlc /home/pi/Desktop/flip.mp4",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "0",
        "winHide": false,
        "oldrc": false,
        "name": "video prox",
        "x": 1990,
        "y": 2120,
        "wires": [
            [
                "28faee78ab6ed0f7",
                "d4176eee38f001a8"
            ],
            [],
            []
        ]
    },
    {
        "id": "7113c94b2fcab982",
        "type": "debug",
        "z": "1fcfdbf29377b8b1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1930,
        "y": 2060,
        "wires": []
    },
    {
        "id": "90699a518d256c08",
        "type": "comment",
        "z": "1fcfdbf29377b8b1",
        "name": "Flip Video",
        "info": "",
        "x": 1780,
        "y": 2020,
        "wires": []
    },
    {
        "id": "5ab68ff574467b98",
        "type": "inject",
        "z": "1fcfdbf29377b8b1",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1480,
        "y": 2000,
        "wires": [
            [
                "f86d94e5c069e151"
            ]
        ]
    },
    {
        "id": "6e3151de1c800851",
        "type": "inject",
        "z": "1fcfdbf29377b8b1",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 1580,
        "y": 1860,
        "wires": [
            [
                "9d808f3ddcae193e"
            ]
        ]
    },
    {
        "id": "9d808f3ddcae193e",
        "type": "exec",
        "z": "1fcfdbf29377b8b1",
        "command": "killall -9 vlc && export DISPLAY=:1 && vlc /home/pi/Desktop/proche.mp4",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "0",
        "winHide": false,
        "oldrc": false,
        "name": "Video loop",
        "x": 1790,
        "y": 1800,
        "wires": [
            [
                "8f7da37cc60da0a7"
            ],
            [],
            []
        ]
    },
    {
        "id": "da58947a2f5fb17d",
        "type": "rpi-srf",
        "z": "1fcfdbf29377b8b1",
        "name": "Capteur de proximité",
        "topic": "SRF",
        "pulse": "0.5",
        "pins": "35,37",
        "precision": "0",
        "x": 1490,
        "y": 2120,
        "wires": [
            [
                "d9804431926b90fe"
            ]
        ]
    },
    {
        "id": "28faee78ab6ed0f7",
        "type": "delay",
        "z": "1fcfdbf29377b8b1",
        "name": "restart video",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 2230,
        "y": 2120,
        "wires": [
            [
                "9d808f3ddcae193e"
            ]
        ]
    },
    {
        "id": "8f7da37cc60da0a7",
        "type": "debug",
        "z": "1fcfdbf29377b8b1",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 2110,
        "y": 1700,
        "wires": []
    },
    {
        "id": "d4176eee38f001a8",
        "type": "debug",
        "z": "1fcfdbf29377b8b1",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 2780,
        "y": 2280,
        "wires": []
    },
    {
        "id": "e3442a262b51d902",
        "type": "comment",
        "z": "1fcfdbf29377b8b1",
        "name": "Video loop",
        "info": "",
        "x": 1780,
        "y": 1740,
        "wires": []
    }
]

thanks in advance.

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