Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
667 views
in Technique[技术] by (71.8m points)

RTSP (video stream) in Electron

I've installed fluent-ffmpeg and ffmpeg-static to convert a stream into an HTML reproducible video. How can I use these packages to display the stream in the client?

Server side (main.js):

const { app, BrowserWindow } = require('electron');
const ffmpeg                 = require('fluent-ffmpeg');
const ffmpegPath             = require('ffmpeg-static').replace('app.asar', 'app.asar.unpacked');

ffmpeg.setFfmpegPath(ffmpegPath);

function createWindow () {
    
    const win = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
          nodeIntegration: true
        }
    });

    win.loadFile('index.html');
}

function testStream () {
    
   let source = 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov';

    
}

app.whenReady().then(createWindow).then(testStream);

Client side (index.html):

<!DOCTYPE html>
<html>
<head>
    <meta charset = 'UTF-8'>
</head>
<body>
    <h1>I want to reproduce the video here</h1>

</body>
</html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If I understand correctly; you're probably looking to start with something like this:

    <video id="video-player" controls preload="none" style="border: 5px solid red; height: 1080px; width: 1920px; ">
        <source src="index.m3u8" type="application/x-mpegURL">
    </video>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...