我正在制作一个html5网页,该网页会在桌面上嵌入RTMP
直播,并使用ffmpeg
将流媒体转换为Mpeg
移动版。我正在使用video.js
和jsmpeg
来播放流媒体。
问题是:
我有很多流媒体资源,所以我在徘徊有没有办法选择具有最佳性能的来源?我可以使用JavaScript来测试流媒体源的质量吗?
实用代码示例:
// I got several source
let streamingSrc1 = "ws://192.168.124.227:8084";
let streamingSrc2 = "ws://192.168.133.228:8086";
let streamingSrc3 = "ws://192.168.155.229:8088";
////// Could I get the quality of streaming source before I decide to use it?
let jsmpegSrc = streamingSrc1;
// or
// let jsmpegSrc = streamingSrc2;
// or
// let jsmpegSrc = streamingSrc3;
// create jsmpeg player
let canvasId = "mpegPlayer";
let canvasDOM = document.getElementById(canvasId);
let player = new JSMpeg.Player(jsmpegSrc, {
canvas: canvasDOM,
videoBufferSize: 128 * 1024,
});
非常感谢你的帮助