Using Media node for node red dashboard - Video Autoplay "Run on Start" not working

Dear All,

I am using Media node for running a video on Node red dashboard.
Everything works well except that video does not start automatically. I have enabled "run on start" option. Still everytime, I have to press play button to make it play.

Node Red version: v2.2.2
Media node version: 1.2.0

my flow is as below:

[
    {
        "id": "66a893890f0d1afc",
        "type": "ui_media",
        "z": "2a49a3ed09ee2b01",
        "group": "2ead0f3054aaadd1",
        "name": "",
        "width": 24,
        "height": 16,
        "order": 1,
        "category": "videos",
        "file": "Saral Technologies_Presentation - 02102022.mp4",
        "layout": "adjust",
        "showcontrols": true,
        "loop": true,
        "onstart": true,
        "scope": "local",
        "tooltip": "",
        "x": 410,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "2ead0f3054aaadd1",
        "type": "ui_group",
        "name": "Screen1",
        "tab": "2a3bf24941459982",
        "order": 1,
        "disp": false,
        "width": 30,
        "collapse": false,
        "className": ""
    },
    {
        "id": "2a3bf24941459982",
        "type": "ui_tab",
        "name": "CTQ_Screen",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Screen shot for Media node configuration:

image

Please help with suggestion to make it Auto Play everytime any user open the dashboard.

thanks.

I know on my browsers i have disabled auto start video, maybe your browser is set to not auto start to.

1 Like

Most if not all browsers refuse autoplay unless the user has interacted with the page in some way. This is to prevent annoying autoplay video adverts from automatically running. If I remember correctly, this is mentioned in the MDN documentation.

1 Like

Thanks E1cid. I am using Chrome and I have checked all the settings suggested by Google Chrome. Still Its not working.

Thanks. I try to find a way out to enable it for Chrome, but could not find one. can you please help with few pointers to enable AutoPlay?

If the video contains audio, then autostart will usually not work unless the video player is set muted.

1 Like

This is not user controllable, as I said, the details are on MDN.

Autoplay guide for media and Web Audio APIs - Web media technologies | MDN (mozilla.org)

I have tried both with audio and without audio. Both does not play automatically.

I used the uibuilder rather than dashboard media node. with following code in html, i could achieve the autoplay of desired video.
Thank you very much for your efforts to make uibuilder and continuously updating it.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <video width=80% height=auto autoplay muted>
    <source src="my_video.mp4" type="video/mp4">
    </video>
</body>
</html>

I need to keep the video in same src folder though.
If I mention the following absolute path, it works well with normal HTML page. but not with uibuilder. Is there any other specific way to define absolute path in uibuilder?

absolute path : "//C:/folder1/my_video.mp4"

Please guide.Preformatted text

You cannot do that even if Node-RED and the browser run on the same device. Partly because it would be a security issue to mix domains and partly because anything coming from a local folder is not being served by a web server.

I think I already mentioned that you can use filing system links to make it seem like something is in one place but is really in another. So you can create a link that tells Windows that something like ~/.node-red/uibuilder/myweb/my_video.mp4 actually exists for real at C:/folder1/my_video.mp4. That way uibuilder can still serve it up for you.

Well it might work ok if you load the html file into the browser without using a web server. But it shouldn't if you use a web server - that isn't a uibuilder thing, it is a browser security feature.

It also wouldn't help you if Node-RED were running on a different device which is the "normal" scenario for live services. In that case, your browser only has 1 way of talking to the server's filing system and that is via the http(s) protocol which requires a web server - Node-RED via ExpressJS in this case.

Another way to think about it is that your browsers local filing system is in a totally different context to the filing system of the server. Node-RED is a server, your browser is a client and they are designed to work on different devices from each other.

Maybe this picture will help:

Anyway, look up filing system links and junctions.

1 Like

Thanks for a detailed explanation. I will try the same.

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