当前位置:网站首页>Browser plays RTSP video based on nodejs
Browser plays RTSP video based on nodejs
2022-06-30 12:19:00 【Wangxiaomin】
Browser play rtsp video , be based on nodeJs
1: install ffmpeg, And configure environment variables .
Download address :http://ffmpeg.zeranoe.com/builds/ perhaps :
Baidu cloud link :https://pan.baidu.com/s/1PBt18BHFGpdr0lpoUp5cKw
Extraction code :hx08
To configure :

Copy file address , Back to the desktop , Right click My computer / This computer , Click on Advanced system setup , senior , Click on environment variable
Click on path

Set the path

win + r Input cmd
Input ffmpeg enter

success
2:npm install node-rtsp-stream ws
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
node xx.js Start the service
3: html Page play video
jsmpeg/jsmpeg.min.js at master · phoboslab/jsmpeg · GitHub

<!DOCTYPE html>
<html>
<head>
<title>JSMpeg Stream Client</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
.container{
margin: 0 auto;
}
canvas{
background-color: aqua;
display: block;
margin: 10px 0;
}
</style>
</head>
<body>
<div class="container">
<canvas id="video-canvas" width="1366" height="750" style="width:980px;height:544px"></canvas>
</div>
<script type="text/javascript" src="./scripts/jsmpeg.js"></script>
<script type="text/javascript">
const width = document.body.clientWidth;
const height = document.body.clientHeight;
console.log(width,height)
const canvas = document.getElementById('video-canvas');
console.log(document.location.hostname)
var urls = 'ws://localhost:9998';
var players = new JSMpeg.Player(urls, {canvas: canvas});
</script>
</body>
</html>
边栏推荐
猜你喜欢
随机推荐
Parallel interface 8255A
[cf] 803 div2 B. Rising Sand
Constructor, class member, destructor call order
R language ggplot2 visualization: use ggplot2 visualization scatter diagram and the color parameter in AES function to specify that data points in different groups are displayed in different colors
Go 语言入门很简单:Go 处理 XML 文件
R language ggplot2 visualization: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
Openmldb meetup No.4 meeting minutes
qt msvc 安装及调试
剑指 Offer 05. 替换空格: 把字符串 s 中的每个空格替换成“%20“
VScode选中多个单词
麒麟软件韩乃平:数字中国建设需要自己的开源根社区
A Generic Deep-Learning-Based Approach for Automated Surface Inspection-论文阅读笔记
Flutter 从零开始 006 单选开关和复选框
R language ggplot2 visualization: use ggplot2 visualization scatter diagram and the size parameter in AES function to specify the size of data points (point size)
使用Power Designer工具构建数据库模型
R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram, and_ Set show in the point parameter_ The legend parameter is false, and the legend information is not displayed
Splitting e-commerce systems into micro services
A High-Precision Positioning Approach for Catenary Support Components With Multiscale Difference阅读笔记
695.最大岛屿面积
Multiparty cardinality testing for threshold private set-2021: Interpretation






