91.video.ws index.php,index.html



WASM TEST

var defaultProtos = {

http: {

url: "https://roblin.cn/wasm/video/h265_high.mp4",

waitLength : 512 * 1024,

stream: false,

},

ws: {

url: "wss://roblin.cn/wss/h265_high.mp4",

waitLength : 512 * 1024,

stream: false,

},

httpFlv: {

url: "https://data.vod.itc.cn/bee/qf/wasm?tok=e4da89d923e4e2af4d622a0edb717f88827b422a&format=flv&direct=1",

waitLength : 512 * 1024,

stream: true,

}

};

let inputUrl = document.getElementById("inputUrl");

inputUrl.value = defaultProtos["http"]["url"];

//Player object.

self.player = new Player();

var loadingDiv = document.getElementById("loading");

self.player.setLoadingDiv(loadingDiv);

//Formated logger.

var logger = new Logger("Page");

function playVideo() {

var protoList = document.getElementById("protocol");

var proto = protoList.options[protoList.selectedIndex].value;

var protoObj = defaultProtos[proto];

var inputUrl = document.getElementById("inputUrl");

var url = inputUrl.value;

var el = document.getElementById("btnPlayVideo");

var currentState = self.player.getState();

if (currentState == playerStatePlaying) {

el.src = "img/play.png";

} else {

el.src = "img/pause.png";

}

if (currentState != playerStatePlaying) {

const canvasId = "playCanvas";

var canvas = document.getElementById(canvasId);

if (!canvas) {

logger.logError("No Canvas with id " + canvasId + "!");

return false;

}

self.player.play(url, canvas, function (e) {

console.log("play error " + e.error + " status " + e.status + ".");

if (e.error == 1) {

logger.logInfo("Finished.");

}

}, protoObj.waitLength, protoObj.stream);

var timeTrack = document.getElementById("timeTrack");

var timeLabel = document.getElementById("timeLabel");

self.player.setTrack(timeTrack, timeLabel);

} else {

self.player.pause();

}

return true;

}

function stopVideo() {

self.player.stop();

var button = document.getElementById("btnPlayVideo");

button.value = "Play";

button.src = "img/play.png";

}

function fullscreen() {

self.player.fullscreen();

}

function onSelectProto() {

var protoList = document.getElementById("protocol");

var proto = protoList.options[protoList.selectedIndex].value;

var protoObj = defaultProtos[proto];

var inputUrl = document.getElementById("inputUrl");

inputUrl.value = protoObj["url"];

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值