All Projects → v354412101 → wsPlayer

v354412101 / wsPlayer

Licence: other
wsPlayer is a web video player based on WebSocket-fmp4.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to wsPlayer

Xgplayer
A HTML5 video player with a parser that saves traffic
Stars: ✭ 4,792 (+5345.45%)
Mutual labels:  video-player, fmp4
aWsm
WebAssembly ahead-of-time compiler and runtime. Focuses on generating fast code, simplicity, and portability.
Stars: ✭ 177 (+101.14%)
Mutual labels:  wasm
DoubleTapPlayerView
YouTube's Fast-Forward-Rewind double tapping feature built on top of ExoPlayer
Stars: ✭ 81 (-7.95%)
Mutual labels:  video-player
vcplayerbot
Play songs directly in telegram voice chats.
Stars: ✭ 48 (-45.45%)
Mutual labels:  video-player
video-server
Server which connects to set of existing RTSP's and provides HLS/MSE-based streams.
Stars: ✭ 12 (-86.36%)
Mutual labels:  video-player
hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (+334.09%)
Mutual labels:  wasm
voronoi-video
Fragmented HTML5 using the Voronoi diagram
Stars: ✭ 13 (-85.23%)
Mutual labels:  video-player
dailymotion-player-sdk-ios
Dailymotion Player SDK for iOS
Stars: ✭ 58 (-34.09%)
Mutual labels:  video-player
vgg runtime
VGG Runtime for loading and running designs as apps.
Stars: ✭ 19 (-78.41%)
Mutual labels:  wasm
advene
Official Advene repository
Stars: ✭ 32 (-63.64%)
Mutual labels:  video-player
oplayer
👾 react native video player for expo
Stars: ✭ 25 (-71.59%)
Mutual labels:  video-player
niki
Media Player, DLNA, Music, Video and Streaming
Stars: ✭ 14 (-84.09%)
Mutual labels:  video-player
clappr-stats
A clappr plugin to report playback statuses (timers: session, buffering, watch and counters: play, pause, error, fps)
Stars: ✭ 40 (-54.55%)
Mutual labels:  video-player
ZoomableVideo
PinchZoom on TextureView while playing your videos
Stars: ✭ 17 (-80.68%)
Mutual labels:  video-player
emscripten-webxr
WebXR library for use with Emscripten.
Stars: ✭ 21 (-76.14%)
Mutual labels:  wasm
deplayer
Decentralized mediaplayer which runs entirely in the browser.
Stars: ✭ 14 (-84.09%)
Mutual labels:  video-player
dokuwiki-plugin-vshare
Plugin to easily embed videos from various video sharing sites into DokuWiki
Stars: ✭ 15 (-82.95%)
Mutual labels:  video-player
python-wasm
Build scripts and configuration for building CPython for Emscripten
Stars: ✭ 606 (+588.64%)
Mutual labels:  wasm
go-wasm-pdfcpu
Running a Command line tool written in Go on browser with WebAssembly
Stars: ✭ 79 (-10.23%)
Mutual labels:  wasm
watpl
Create WebAssembly modules using template strings
Stars: ✭ 14 (-84.09%)
Mutual labels:  wasm

Logo wsPlayer

​ wsPlayer是一款专注于WebSocket-fmp4协议的web视频播放器,HTTP/WebSocket-fmp4协议与RTMP、HLS、HTTP-FLV相比,具有播放延时短,HTML5兼容性好等优点;

见各流媒体协议对比:

协议名称 网络传输协议 延时 编码类型 HTML5支持情况
RTSP TCP/UDP/组播 0~3s H264/H265 不支持,(RTSP over HTTP除外)
RTMP TCP 0~3s H264/H265(CodecID =12) 不支持
HLS HTTP短连接 1~10s H264/H265 video标签支持
HTTP-FLV HTTP长连接 0~3s H264/H265(CodecID =12) flv → fmp4 → video标签
HTTP-fmp4 HTTP长连接 0~3s H264/H265 video标签原生支持
WebSocket-FLV WebSocket 0~3s H264/H265(CodecID =12) flv → fmp4 → video标签
WebSocket-fmp4 WebSocket 0~3s H264/H265 使用MSE,vidoe标签播放

备注:浏览器对单个页面的HTTP长连接的并发数限制为6个,这意味着HTTP-FLV、HTTP-fmp4只能同时播放6个视频画面;但浏览器对WebSocket的连接数没有限制;

项目依赖

需要使用mp4box.js来解析fmp4 moov中的codecs;

快速开始

推荐使用ZLMediaKit作为WebSocket-fmp4协议的后端流媒体服务器

  1. 部署后端流媒体服务器
docker pull panjjo/zlmediakit
docker run -id -p 8080:80 -p 554:554 panjjo/zlmediakit
  1. 使用ffmpeg命令,向ZLMediaKit添加一路RTSP推流
ffmpeg -re -stream_loop -1 -i test.mp4 -an -vcodec copy -f rtsp -rtsp_transport tcp rtsp://100.100.154.29/live/test
  1. 根据ZLMediaKit的播放url规则得知,WebSocket-fmp4协议的URL格式为:
ws://100.100.154.29:8080/live/test.live.mp4
  1. 然后调用播放器代码:
<html>
<head>
</head>
<body>
    <script type="text/javascript" src="mp4box.all.min.js"></script>
    <script type="text/javascript" src="wsPlayer.js"></script>
    <video muted autoplay id="video"></video>
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            var player = new wsPlayer("video", "ws://100.100.154.29:8083/live/test.live.mp4");
            player.open();
        });
    </script>
</body>
</html>

播放器原理

​ 将WebSocket收到的fmp4 Segment片段appendBufferMediaSource中,此时video.buffered会记录当前已经appendBuffer的视频时间段,然后将video.buffered的起始时间设置给video.currentTime,然后浏览器就会从video.buffered缓存的视频开始播放

项目计划

  • v1.0 实现用video标签,调用MSE播放WebSocket-fmp4(H.264)直播流,并把播放器封装为标准的npm组件;
  • v2.0 实现用WebAssembly FFmpeg解码H.265,然后用canvas标签WebGL渲染YUV,从而实现播放WebSocket-fmp4(H.265)直播流,并实现动态切换H.264、H.265这两种播放机制;
  • v3.0 实现视频流SEI信息的callback回调

联系方式

  • QQ交流群:群名称:wsPlayer 群号:710185138
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].