Search code examples
nwjsffplay

Is it possible to embed another application's GUI within an NWJS app?


ffplay does a very fine job of displaying 4K content streamed using RTSP, better than any I've seen so far. ffplay opens its own window for viewing. I would like to develop an app using NWJS for viewing CCTV content over a network. Is there a way I can embed ffplay, including its viewer within the NWJS app?


Solution

  • NW.js is a modified Chromium browser with Node.js built in. Your HTML/CSS/JS code is used to construct a DOM that is then rendered via Chromium. Chromium communicates with the OS and hardware (GPU), to decide what pixels are displayed within it's Window. What you display in your browser window will be limited to what browsers are capabale of displaying (DOM elements such as <div>, <h1>, <video>, <canvas> etc.)

    In short. No.

    If you license FFPlay to be shipped with your application (read their license), then the copy of Node.js built in to NW.js can be used to run a child process of the ffplay.exe executable. Which would show it in a separate window.

    If you want to display video in your NW.js window. Use the <video> tag. Though, be aware that you will be limited to the open source codecs that NW.js ships with, unless you obtain a license to ship your code with FFMPEG, in which case you can use a pre-built version of FFMPEG for NW.js supplied by the community:

    It may be possible to read in the pixel output of another window into NW.js and display those pixels in a <canvas> element. However I'm not sure that will give you the result you want.