当前位置:网站首页>浏览器播放rtsp视频,基于nodeJs
浏览器播放rtsp视频,基于nodeJs
2022-06-30 11:54:00 【汪小敏同学】
浏览器播放rtsp视频,基于nodeJs
1:安装ffmpeg,并且配置环境变量。
下载地址:http://ffmpeg.zeranoe.com/builds/ 或者:
百度云链接:https://pan.baidu.com/s/1PBt18BHFGpdr0lpoUp5cKw
提取码:hx08
配置:

复制文件地址,返回桌面,右键我的电脑/此电脑,点击高级系统设置,高级,点击环境变量
点击path

设置路径

win + r 输入cmd
输入ffmpeg 回车

成功
2:npm install node-rtsp-stream ws
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
node xx.js 启动服务
3: html页面播放视频
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>
边栏推荐
- Statistics on the number of closed Islands
- STM32 porting the fish component of RT thread Standard Edition
- led背光板的作用是什麼呢?
- In depth analysis of Apache bookkeeper series: Part 4 - back pressure
- 来聊聊怎么做硬件兼容性检测,快速迁移到openEuler?
- DMA控制器8237A
- MATLAB中polarplot函数使用
- What is the function of LED backlight?
- A quietly rising domestic software, low-key and powerful!
- Shell first command result is transferred to the second command delete
猜你喜欢

聊聊怎么做硬件兼容性检测,快速迁移到openEuler?

STM32 porting the fish component of RT thread Standard Edition

c# 怎样能写个sql的解析器

「运维有小邓」用户个人资料管理

【模式识别大作业】

Analysis of KOA - onion model

If it is not listed again, Kuangshi technology will not be able to endure
Redis - ziplist compressed list

Another miserable day by kotlin grammar
Redis - SDS simple dynamic string
随机推荐
1020. 飞地的数量
A Generic Deep-Learning-Based Approach for Automated Surface Inspection-論文閱讀筆記
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)
Analysis of KOA - onion model
服务器常用的一些硬件信息(不断更新)
1020. number of enclaves
Flutter 从零开始 005 图片及Icon
beego开发博客系统学习(二)
R language ggplot2 visualization: gganimate package is based on Transition_ The time function creates a dynamic scatter graph animation (GIF), and uses the labs function to add a dynamic time title to
R语言ggplot2可视化:使用ggplot2可视化散点图、aes函数中的size参数指定数据点的大小(point size)
聊聊怎么做硬件兼容性检测,快速迁移到openEuler?
论文解读(AGC)《Attributed Graph Clustering via Adaptive Graph Convolution》
nvm安装node后,在使用npm指令时候显示不是内部或外部指令
Object mapping - mapping Mapster
Constructor, class member, destructor call order
[cf] 803 div2 A. XOR Mixup
R language ggplot2 visualization: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
Beego development blog system learning (II)
Quel est le rôle du rétroéclairage LED?
Go 语言入门很简单:Go 处理 XML 文件