Search code examples
htmlvideoelectrondesktop-applicationmp4

Playing videos in electron


I'm currently writing an electron application to run as a desktop app on Windows. I'm trying to embed a video on the page to all the end user to play it and it appear impossible.

Sample code is:

 <video  controls="">
    <source src="../../../2.mp4" type="video/mp4">
 </video>

I have checked and tried the following solutions and a few others:

And I've unfortunately had no success.

Thanks in advance for any help or support.

Regards

Patrick


Solution

  • Solution here was to use the node-cmd module and pass the file path to the command prompt which opens the file in the OS' default program.

    Code:

    const cmd = require("node-cmd")
    cmd.runSync("/your/file/path/video.mp4")