代码拉取完成,页面将自动刷新
import {LogLevel, getTagged, setDefaultLogLevel} from 'bp_logger';
import * as streamedian from 'streamedian/player.js';
import WebsocketTransport from 'streamedian/transport/websocket.js';
import RTSPClient from 'streamedian/client/rtsp/client.js';
import {isSafari} from "streamedian/core/util/browser.js";
setDefaultLogLevel(LogLevel.Debug);
getTagged("transport:ws").setLevel(LogLevel.Error);
getTagged("client:rtsp").setLevel(LogLevel.Debug);
getTagged("mse").setLevel(LogLevel.Debug);
let wsTransport = {
constructor: WebsocketTransport,
options: {
socket: "wss://specforge.com/ws/"
// socket: "ws://localhost:8080/ws/"
}
};
window.StreamedianPlayer = new streamedian.WSPlayer('test_video', {
// url: `${STREAM_UNIX}${STREAM_URL}`,
// type: wsp.StreamType.RTSP,
modules: [
{
client: RTSPClient,
transport: wsTransport
}
],
errorHandler (e){
alert(`Failed to start player: ${e.message}`);
},
queryCredentials(client) {
return new Promise((resolve, reject)=>{
let c = prompt('input credentials in format user:password');
if (c) {
this.setCredentials.apply(this, c.split(':'));
resolve();
} else {
reject();
}
});
}
});
var setUrl = document.getElementById('set_new_url');
setUrl.onclick = function() {
StreamedianPlayer.setSource(document.getElementById('stream_url').value, streamedian.StreamType.RTSP);
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。