一套完整的Web版H.265播放器解决方案,非常适合学习交流和实际应用。基于JS码流解封装、WebAssembly(FFmpeg)视频解码,利用Canvas画布投影、AudioContext播放音频。
H.264, H.265 WebH.265Web Assembly(FFmpeg)JSCanvasAudioContextWebH265
Chrome>57 Safari (>11) Firefox (>52)
#
* mkdir goldvideo
* cd goldvideo
# h265player, h265player
* git clone https://github.com/goldvideo/h265player.git
* cd h265player
#
* npm install
#
* npm run dev #
* npm run test #
* npm run build #
* rollup -c # csjesm
server {
listen 8000;
location / {
root <path of goldvideo>/goldvideo;
index index.html index.htm;
autoindex on;
}
}
nginxdemo http://localhost:8000/h265player/demo/demo.html
# npmDEMO
* npm i goldvideo-player
demuxer npm (https://www.npmjs.com/package/demuxer)
* cd goldvideo
* git clone https://github.com/goldvideo/demuxer.git
* cd demuxer
* npm install
# demuxerpackage.json
* npm install --global rollup
# demuxer
* rollup -c ./rollup.config.js --environment BUILD_MODE:production
* cd h265player
# demuxer
* npm install ../demuxer
decoder_wasm h265player/dist/lib/libffmpeg.jslibffmpeg.wasm
# decoder_wasm
* cd goldvideo
* git clone http://github.com/goldvideo/decoder_wasm.git
* cd decoder_wasm
wasmREADME
goldvideo
demuxer
h265player
decoder_wasm
example
UILoader3
JSH265AACdemuxerhttps://github.com/goldvideo/demuxer
ffmpegH265ffmpegffmpegwasmffmpegwasmdecoder_wasm
yuv-canvasYUVImagePlayerYUVyuvreadybufferLengthImagePlayerReadyreadyH265dataReadyplay
Audio PlayerWeb Audio API, AACPCM
Audio ContextplaybackRatepitch/ SoundTouchJSScriptProcessorNode
<link rel="stylesheet" href="../dist/goldplay-h265.css">
<script src="../dist/goldplay-h265-sdk.js"></script>
<style>
.play-container {
width: 800px;
height: 500px;
}
</style>
<div class="play-container"></div>
//
let el = doc.querySelector('.play-container')
//
let options = {
//
sourceURL: 'http://localhost:8000/h265player/data/video2/playlist.m3u8',
type: 'HLS'
// wasm
libPath: 'http://localhost:8000/h265player/dist/lib',
}
let player = new GoldPlay(el, options}
UI componentadd
https://goldvideo.github.io/h265player/API/index.html
,goldvideo liu635647
Slack https://join.slack.com/t/goldvideo/shared_invite/zt-l0123zsk-jvHxsAQ8bCRl0~4QLNBEeQ
githubforkpull request