提交 9f7d8eae 作者: 翁进城

修复播放器加载js的地址

修复播放器居中问题
上级 0c7545c6
......@@ -309,7 +309,6 @@ export default {
},
},
mounted() {
this.wrapCenter();
},
methods: {
test() {
......@@ -399,11 +398,9 @@ export default {
let centerX = fullWidth / 2 - width / 2;
let centerY = fullHeight / 2 - height / 2;
this.$refs.wrap.setAttribute("data-x", centerX);
this.$refs.wrap.setAttribute("data-y", centerY);
this.$refs.wrap.setAttribute(
"style",
`transform: translate(${centerX}px, ${centerY}px)`
`position: fixed; top: ${centerY}px; left: ${centerX}px;`
);
});
},
......
var g_player_process = null;
var g_audio_render = null;
var g_video_callback_map = {};
var g_delay_callback_map = {};
var script_path = document.getElementsByTagName('script')[document.getElementsByTagName('script').length -1].src;
var js_fname = script_path.split('/')[script_path.split('/').length-1];
var script_path_base = script_path.replace(js_fname, '');
var libplayer_js_path = script_path_base + "libplayer.js";
var audio_render_js_path = script_path_base + "audio_render.js";
function num2str(num) {
var str = String(Math.floor(num * 1000));
while (str.length <= 3) {
str = "0" + str;
}
return (str.substring(0, str.length - 3)) + "." + str.substring(str.length - 3);
}
function onfullscreenchange(e) {
if (!document.fullscreenElement) {
g_player_process.postMessage({user_cmd:"exitfullscreen"});
}
}
function fullscreen(layer_name) {
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
let canvas_obj = document.getElementById("canvas_" + layer_name);
canvas_obj.requestFullscreen();
g_player_process.postMessage({user_cmd:"fullscreen", layer_name:layer_name, width:window.screen.width, height:window.screen.height});
}
}
function show_ability() {
g_player_process.postMessage({user_cmd:"show_ability"});
}
function save_blob(filename, blob) {
var link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
URL.revokeObjectURL(link.href);
}
function save_file(filename, content) {
var blob = new Blob([content], {type: "application/octet-stream"});
save_blob(filename, blob);
}
function save_bitmap(filename, bitmap) {
var cvs_obj = document.createElement("canvas");
var cvs_ctx = cvs_obj.getContext("2d");
cvs_obj.width = bitmap.width;
cvs_obj.height = bitmap.height;
cvs_ctx.drawImage(bitmap, 0, 0);
cvs_obj.toBlob(blob => { save_blob(filename, blob);});
}
function PIMediaPlayer_msg_handler(e) {
var ret = 1;
switch (e.data["user_cmd"]) {
case "audio_process_resp":
g_audio_render.worklet.port.postMessage(e.data); // transfer to worklet
break;
case "media_play_control":
if (g_audio_render) {
g_audio_render.play_control(e.data["command"], e.data["arg"]);
}
break;
case "set_audio_play_sample_rate":
if (!g_audio_render) {
g_audio_render = new PIAudioRender();
}
g_audio_render.set_sample_rate(e.data["sample_rate"]);
break;
case "video_callback":
if (g_video_callback_map.hasOwnProperty(e.data["media_name"])) {
g_video_callback_map[e.data["media_name"]](e.data["media_name"], e.data["yuvdata"], e.data["width"], e.data["height"], e.data["pts"], e.data["orig_stamp"]);
}
break;
case "delay_callback":
if (g_delay_callback_map.hasOwnProperty(e.data["media_name"])) {
g_delay_callback_map[e.data["media_name"]](e.data["media_name"], e.data["delay_ms"]);
}
break;
case "save_bitmap":
save_bitmap(e.data["fname"], e.data["bitmap"]);
break;
case "save_file":
save_file(e.data["filename"], e.data["content"]);
break;
default:
// console.log("message from player: ", e.data);
ret = 0;
break;
}
return ret;
}
function PIMediaPlayer_set_display_rotate(media_name, degree) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"set_display_rotate", media_name:media_name, stream_name:"video0", degree:degree});
}
}
function PIMediaPlayer_set_video_callback(media_name, callback) {
if (g_player_process) {
if (callback && callback != null) {
g_video_callback_map[media_name] = callback;
g_player_process.postMessage({user_cmd:"set_video_callback", media_name:media_name, stream_name:"video0", value:1});
} else if (g_video_callback_map.hasOwnProperty(media_name)) {
delete g_video_callback_map[media_name];
g_player_process.postMessage({user_cmd:"set_video_callback", media_name:media_name, stream_name:"video0", value:0});
}
}
}
function PIMediaPlayer_set_delay_callback(media_name, callback) {
if (callback && callback != null) {
console.warn("deprecated PIMediaPlayer_set_delay_callback, use qoeinfo instead");
g_delay_callback_map[media_name] = callback;
} else if (g_delay_callback_map.hasOwnProperty(media_name)) {
delete g_delay_callback_map[media_name];
}
}
function PIMediaPlayer_set_display_size(layer_name, width, height) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"resize", layer_name:layer_name, width:width, height:height});
}
}
function PIMediaPlayer_save_screenshot(fname, media_name, width=0, height=0, degree=0) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"save_screenshot", fname:fname, media_name:media_name, stream_name:"video0", width:width, height:height, degree:degree});
}
}
function PIMediaPlayer_init(callback, pthread_pool_size) {
if (g_player_process) {
console.error("g_player_process inited already");
} else {
var poolsize = (typeof(pthread_pool_size) == "undefined") ? 24 : pthread_pool_size;
g_player_process = new Worker(libplayer_js_path, {name:"PIMediaPlayer[pool="+poolsize+"]"});
g_player_process.onmessage = callback;
document.addEventListener("fullscreenchange", onfullscreenchange);
}
}
function PIMediaPlayer_create(media_name, url, module_url) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"create", media_name:media_name, url:url, module_url:module_url});
}
}
function PIMediaPlayer_destroy(media_name) {
if (g_audio_render) {
g_audio_render.play_control("suspend", 0);
}
if (g_player_process) {
g_player_process.postMessage({user_cmd:"destroy", media_name:media_name});
}
}
function PIMediaPlayer_set_ptcp_log_level(level) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"set_ptcp_log_level", level:level});
}
}
function PIMediaPlayer_set_pslstreaming_log_level(level) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"set_pslstreaming_log_level", level:level});
}
}
function PIMediaPlayer_set_psdemux_log_level(level) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"set_psdemux_log_level", level:level});
}
}
function PIMediaPlayer_add_canvas(canvas_list, layers) {
var offscreen_list = [];
for (var i = 0; i < canvas_list.length; i++) {
offscreen_list.push(canvas_list[i]["offscreen"]);
}
g_player_process.postMessage({user_cmd:"add_canvas", canvas_list:canvas_list, layers:layers}, offscreen_list);
}
function PIMediaPlayer_del_canvas(layer_names) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"del_canvas", "layers": layer_names});
}
}
function PIMediaPlayer_update_binds(binds) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"update_binds", binds:binds});
}
}
function PIMediaPlayer_set_volume(volume) {
if (!g_audio_render) {
g_audio_render = new PIAudioRender();
}
g_audio_render.set_volume(volume); /* volume 0~100 */
}
function PIMediaPlayer_set_dbgopt(opt) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"set_dbgopt", opt:opt});
}
}
function get_file(filename) {
if (g_player_process) {
g_player_process.postMessage({user_cmd:"get_file", filename:filename});
}
}
class PIAudioRender {
constructor() {
this.audio_ctx;
this.gain_node;
this.sample_rate = 48000;
this.volume = 100;
this.worklet;
this.has_audio = false;
this.state = "ready";
var btn_obj = document.createElement("input");
btn_obj.setAttribute("type", "button");
btn_obj.setAttribute("value", "play");
// document.getElementById("audio_btns").appendChild(btn_obj);
let render = this;
btn_obj.addEventListener("click", function(e) {
render.play_toggle();
});
this.control_btn = btn_obj;
}
create_worklet(sample_rate) {
if (sample_rate) {
this.sample_rate = sample_rate;
}
if (typeof(this.worklet) != "undefined") {
return;
}
var worklet_process = new AudioWorkletNode(this.audio_ctx, "audio_render");
worklet_process.port.onmessage = this.worklet_msg_handler.bind(this);
var buff = this.audio_ctx.createBuffer(2, 20, this.sample_rate); // length doesn't matter, just start play
for (var i = 0; i < buff.numberOfChannels; i++) {
var channel = buff.getChannelData(i);
channel.fill(0); // content doesn't matter, just start play
}
var buff_src = this.audio_ctx.createBufferSource();
buff_src.buffer = buff;
buff_src.loop = true;
buff_src.connect(worklet_process);
this.gain_node = this.audio_ctx.createGain();
worklet_process.connect(this.gain_node);
this.gain_node.connect(this.audio_ctx.destination);
this.gain_node.gain.value = this.volume / 100;
buff_src.start(0);
this.worklet = worklet_process;
}
set_sample_rate(sample_rate) {
if (!this.has_audio) {
this.audio_ctx = new AudioContext();
this.has_audio = true;
this.audio_ctx.audioWorklet.addModule(audio_render_js_path).then(ret => {
this.create_worklet(sample_rate);
});
} else {
this.create_worklet(sample_rate);
}
this.play_control("resume", 0);
}
set_volume(volume) {
if (!this.has_audio) {
this.audio_ctx = new AudioContext();
this.has_audio = true;
this.audio_ctx.audioWorklet.addModule(audio_render_js_path).then(ret => {
this.create_worklet();
});
} else {
this.create_worklet();
}
this.volume = volume;
if (this.gain_node) {
this.gain_node.gain.value = this.volume / 100;
}
}
worklet_msg_handler(e) {
switch (e.data["user_cmd"]) {
case "audio_process":
if (!this.has_audio || this.state != "playing") {
break;
}
g_player_process.postMessage(e.data); // transfer to player
break;
default:
console.log("message from worklet: ", e.data);
break;
}
}
play_control(command, arg) {
switch(command) {
case "start":
if (this.state == "ready") {
if (this.has_audio) {
this.state = "playing";
this.control_btn.setAttribute("value", "pause");
}
}
break;
case "suspend":
if (this.state == "playing") {
if (this.has_audio) {
this.audio_ctx.suspend();
this.state = "suspend";
this.control_btn.setAttribute("value", "play");
}
}
break;
case "resume":
if (this.state == "suspend") {
if (this.has_audio) {
this.audio_ctx.resume();
this.state = "playing";
this.control_btn.setAttribute("value", "pause");
}
}
break;
case "stop":
if (this.has_audio) {
this.audio_ctx.close();
this.control_btn.disabled = true;
this.audio_ctx = null;
}
break;
default:
console.log("unknown command: ", command);
break;
}
}
play_toggle() {
if (this.state == "playing") {
this.play_control("suspend", 0);
} else if (this.state == "ready") {
this.play_control("start", 0);
} else if (this.state == "suspend") {
this.play_control("resume", 0);
}
}
}
class AudioRender extends AudioWorkletProcessor {
constructor(context, param) {
super(context, param);
this.queue = [];
this.queue_1st_offset = 0;
this.queue_length = 0;
this.port.onmessage = this.message_handler.bind(this);
this.req_id = 0;
}
message_handler(e) {
// console.log("enter message_handler");
switch (e.data["user_cmd"]) {
case "audio_process_resp":
var waves = e.data["waves"];
this.queue.push(waves);
// console.log(e.data["req_id"] + " resp " + this.queue_length + " => " + (this.queue_length + waves[0].length));
this.queue_length += waves[0].length;
// console.log("%cafter push: " + this.queue_length, "color:#0f0;");
break;
default:
console.log("unknown command " + e.data["user_cmd"]);
break;
}
}
noise(output, channel="both") {
var start = 0;
var end = output.length;
if (channel == "left") {
end = 1;
} else if (channel == "right") {
start = 1;
}
for (var i = start; i < end; i++) {
var out_ch = output[i];
for (var j = 0; j < out_ch.length; j++) {
out_ch[j] = Math.random() * 0.2 - 0.1;
}
}
}
process(inputs, outputs, parameters) {
// console.log(inputs, outputs, parameters);
var output = outputs[0];
var channels_cnt = output.length;
var need_update = output[0].length;
// console.log(this.queue_length, need_update);
if (this.queue_length < 1024) {
this.port.postMessage({user_cmd:"audio_process",req_id:this.req_id,length:need_update});
}
// console.log(this.req_id + " req");
// this.req_id++;
if (this.queue_length < need_update) {
// console.log("%cfill zero", "color:#f00;");
for (var i = 0; i < output.length; i++) {
var out_ch = output[i];
out_ch.fill(0); // keep mute
}
// this.noise(output, "right");
// this.noise(output);
return true;
}
while (true) {
if (this.queue.length == 0) {
console.error("inner error, no more data");
break;
}
var in_data = this.queue[0];
var in_chn_num = in_data.length;
var in_len = in_data[0].length;
if (in_len - this.queue_1st_offset <= need_update) {
for (var i = 0; i < channels_cnt; i++) {
var in_chn = in_data[i < in_chn_num ? i : 0];
var out_ch = output[i];
out_ch.set(in_chn.slice(this.queue_1st_offset), out_ch.length - need_update);
}
need_update -= in_len - this.queue_1st_offset;
this.queue_1st_offset = 0;
// console.log("shift");
this.queue.shift();
} else {
for (var i = 0; i < channels_cnt; i++) {
var in_chn = in_data[i < in_chn_num ? i : 0];
var out_ch = output[i];
out_ch.set(in_chn.slice(this.queue_1st_offset, this.queue_1st_offset + need_update), out_ch.length - need_update);
}
this.queue_1st_offset += need_update;
need_update = 0;
}
// console.log("need_update: " + need_update);
if (need_update <= 0) {
this.queue_length -= output[0].length;
// console.log("after used: " + this.queue_length);
if (need_update != 0) {
console.error("inner error, need_update != 0");
}
break;
}
}
return true;
}
}
registerProcessor('audio_render', AudioRender);
var ktb_isLoad = false;
var ktb_isFirst = true; //是否第一次, 由于同时多个清流实例调用初始化方法会导致无法正常返回,需要做间隔
var initQueue = [];
function kbt_sdk_load() {
return new Promise(function (resolve, reject) {
if (ktb_isLoad) {
return resolve();
}
let timeout = 0;
if (!ktb_isFirst) {
timeout = 5000;
} else {
ktb_isFirst = false;
}
setTimeout(() => {
console.log("qingliu ktb_isFirst", Date.now(), ktb_isFirst);
if (ktb_isLoad) {
return resolve();
}
PIMediaPlayer_init(function (e) {
// console.log('PIMediaPlayer_init', e)
if (PIMediaPlayer_msg_handler(e) == 1) {
return;
}
switch (e.data["user_cmd"]) {
case "player_ready":
ktb_isLoad = true;
resolve();
break;
case "qoeinfo":
/* console.log(
"qoeinfo",
e.data["media_name"],
e.data["stream_name"],
JSON.parse(e.data["qoeinfo"])
); */
if (window.$Bus) {
window.$Bus.$emit("qoeinfo", {
media_name: e.data["media_name"],
stream_name: e.data["stream_name"],
data: JSON.parse(e.data["qoeinfo"]),
});
}
break;
case "raw_msg":
if (window.$Bus) {
if(e.data["what"] == 903){
window.$Bus.$emit("raw_msg", {
media_name: e.data["media_name"],
stream_name: e.data["stream_name"],
data: e.data["arg1"],
});
}
}
break;
}
}, 48);
}, timeout);
});
}
var kbt_instances = [];
function kbt_player_create(name, url, width, height, parentEle) {
console.log("kbt_player_create", name);
kbt_instances.push(name);
let canvas_obj = document.createElement("canvas");
canvas_obj.setAttribute("id", "sdk_canvas_" + name);
canvas_obj.setAttribute("width", width);
canvas_obj.setAttribute("height", height);
parentEle.appendChild(canvas_obj);
let offscreen = canvas_obj.transferControlToOffscreen();
let layer_name = "sdk_layer_" + name;
canvas_list = [{ name: layer_name, offscreen: offscreen }];
canvas_obj.addEventListener("dblclick", function () {
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
let canvas_obj = document.getElementById("sdk_canvas_" + name);
canvas_obj.requestFullscreen();
g_player_process.postMessage({
user_cmd: "fullscreen",
layer_name: layer_name,
width: window.screen.width,
height: window.screen.height,
});
}
});
let dis_name = "sdk_dis_" + name;
let layerinfo = [
{
name: layer_name,
width: width,
height: height,
districts: [
{
name: "sdk_dis_" + name,
position_x: "0px",
position_y: "0px",
width: width,
height: height,
},
],
},
];
PIMediaPlayer_add_canvas(canvas_list, layerinfo);
let bindinfo = {};
bindinfo[name] = { video0: [{ layer: layer_name, district: dis_name }] };
PIMediaPlayer_update_binds(bindinfo);
PIMediaPlayer_create(name, url);
}
function kbt_player_destroy(name) {
console.log("kbt_player_destroy", name);
kbt_instances = kbt_instances.filter((item) => {
return item != name;
});
console.log("kbt_instances", kbt_instances);
PIMediaPlayer_destroy(name);
PIMediaPlayer_del_canvas(["sdk_canvas_" + name]);
let canvas_obj = document.getElementById("sdk_canvas_" + name);
if (canvas_obj) {
canvas_obj.remove();
}
}
[SIJK]
AUDIO_MODE = 1
HWACCEL = 0
DISPLAY_MODE = 1
[GLOBAL]
PSL_LEVEL = 2
PSL_FLUSH = 1
PTCP_LEVEL = 0
PTCP_FLUSH = 1
PLAYER_LEVEL = 2
PLAYER_FLUSH = 1
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @license
* Copyright 2015 The Emscripten Authors
* SPDX-License-Identifier: MIT
*/
// Pthread Web Worker startup routine:
// This is the entry point file that is loaded first by each Web Worker
// that executes pthreads on the Emscripten application.
'use strict';
var Module = {};
// Node.js support
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
if (ENVIRONMENT_IS_NODE) {
// Create as web-worker-like an environment as we can.
var nodeWorkerThreads = require('worker_threads');
var parentPort = nodeWorkerThreads.parentPort;
parentPort.on('message', function(data) {
onmessage({ data: data });
});
var fs = require('fs');
Object.assign(global, {
self: global,
require: require,
Module: Module,
location: {
href: __filename
},
Worker: nodeWorkerThreads.Worker,
importScripts: function(f) {
(0, eval)(fs.readFileSync(f, 'utf8'));
},
postMessage: function(msg) {
parentPort.postMessage(msg);
},
performance: global.performance || {
now: function() {
return Date.now();
}
},
});
}
// Thread-local:
function assert(condition, text) {
if (!condition) abort('Assertion failed: ' + text);
}
function threadPrintErr() {
var text = Array.prototype.slice.call(arguments).join(' ');
// See https://github.com/emscripten-core/emscripten/issues/14804
if (ENVIRONMENT_IS_NODE) {
fs.writeSync(2, text + '\n');
return;
}
console.error(text);
}
function threadAlert() {
var text = Array.prototype.slice.call(arguments).join(' ');
postMessage({cmd: 'alert', text: text, threadId: Module['_pthread_self']()});
}
// We don't need out() for now, but may need to add it if we want to use it
// here. Or, if this code all moves into the main JS, that problem will go
// away. (For now, adding it here increases code size for no benefit.)
var out = () => { throw 'out() is not defined in worker.js.'; }
var err = threadPrintErr;
self.alert = threadAlert;
Module['instantiateWasm'] = (info, receiveInstance) => {
// Instantiate from the module posted from the main thread.
// We can just use sync instantiation in the worker.
var instance = new WebAssembly.Instance(Module['wasmModule'], info);
// TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193,
// the above line no longer optimizes out down to the following line.
// When the regression is fixed, we can remove this if/else.
receiveInstance(instance);
// We don't need the module anymore; new threads will be spawned from the main thread.
Module['wasmModule'] = null;
return instance.exports;
}
self.onmessage = (e) => {
try {
if (e.data.cmd === 'load') { // Preload command that is called once per worker to parse and load the Emscripten code.
// Module and memory were sent from main thread
Module['wasmModule'] = e.data.wasmModule;
Module['wasmMemory'] = e.data.wasmMemory;
Module['buffer'] = Module['wasmMemory'].buffer;
Module['ENVIRONMENT_IS_PTHREAD'] = true;
if (typeof e.data.urlOrBlob == 'string') {
importScripts(e.data.urlOrBlob);
} else {
var objectUrl = URL.createObjectURL(e.data.urlOrBlob);
importScripts(objectUrl);
URL.revokeObjectURL(objectUrl);
}
} else if (e.data.cmd === 'run') {
// This worker was idle, and now should start executing its pthread entry
// point.
// performance.now() is specced to return a wallclock time in msecs since
// that Web Worker/main thread launched. However for pthreads this can
// cause subtle problems in emscripten_get_now() as this essentially
// would measure time from pthread_create(), meaning that the clocks
// between each threads would be wildly out of sync. Therefore sync all
// pthreads to the clock on the main browser thread, so that different
// threads see a somewhat coherent clock across each of them
// (+/- 0.1msecs in testing).
Module['__performance_now_clock_drift'] = performance.now() - e.data.time;
// Pass the thread address inside the asm.js scope to store it for fast access that avoids the need for a FFI out.
Module['__emscripten_thread_init'](e.data.threadInfoStruct, /*isMainBrowserThread=*/0, /*isMainRuntimeThread=*/0, /*canBlock=*/1);
assert(e.data.threadInfoStruct);
// Also call inside JS module to set up the stack frame for this pthread in JS module scope
Module['establishStackSpace']();
Module['PThread'].receiveObjectTransfer(e.data);
Module['PThread'].threadInit();
try {
// pthread entry points are always of signature 'void *ThreadMain(void *arg)'
// Native codebases sometimes spawn threads with other thread entry point signatures,
// such as void ThreadMain(void *arg), void *ThreadMain(), or void ThreadMain().
// That is not acceptable per C/C++ specification, but x86 compiler ABI extensions
// enable that to work. If you find the following line to crash, either change the signature
// to "proper" void *ThreadMain(void *arg) form, or try linking with the Emscripten linker
// flag -s EMULATE_FUNCTION_POINTER_CASTS=1 to add in emulation for this x86 ABI extension.
var result = Module['invokeEntryPoint'](e.data.start_routine, e.data.arg);
Module['checkStackCookie']();
if (Module['keepRuntimeAlive']()) {
Module['PThread'].setExitStatus(result);
} else {
Module['__emscripten_thread_exit'](result);
}
} catch(ex) {
if (ex != 'unwind') {
// ExitStatus not present in MINIMAL_RUNTIME
if (ex instanceof Module['ExitStatus']) {
if (Module['keepRuntimeAlive']()) {
err('Pthread 0x' + Module['_pthread_self']().toString(16) + ' called exit(), staying alive due to noExitRuntime.');
} else {
err('Pthread 0x' + Module['_pthread_self']().toString(16) + ' called exit(), calling _emscripten_thread_exit.');
Module['__emscripten_thread_exit'](ex.status);
}
}
else
{
// The pthread "crashed". Do not call `_emscripten_thread_exit` (which
// would make this thread joinable. Instead, re-throw the exception
// and let the top level handler propagate it back to the main thread.
throw ex;
}
} else {
// else e == 'unwind', and we should fall through here and keep the pthread alive for asynchronous events.
err('Pthread 0x' + Module['_pthread_self']().toString(16) + ' completed its main entry point with an `unwind`, keeping the worker alive for asynchronous operation.');
}
}
} else if (e.data.cmd === 'cancel') { // Main thread is asking for a pthread_cancel() on this thread.
if (Module['_pthread_self']()) {
Module['__emscripten_thread_exit'](-1/*PTHREAD_CANCELED*/);
}
} else if (e.data.target === 'setimmediate') {
// no-op
} else if (e.data.cmd === 'processThreadQueue') {
if (Module['_pthread_self']()) { // If this thread is actually running?
Module['_emscripten_current_thread_process_queued_calls']();
}
} else if (e.data.cmd === 'processProxyingQueue') {
if (Module['_pthread_self']()) { // If this thread is actually running?
Module['_emscripten_proxy_execute_queue'](e.data.queue);
}
} else {
err('worker.js received unknown command ' + e.data.cmd);
err(e.data);
}
} catch(ex) {
err('worker.js onmessage() captured an uncaught exception: ' + ex);
if (ex && ex.stack) err(ex.stack);
if (Module['__emscripten_thread_crashed']) {
Module['__emscripten_thread_crashed']();
}
throw ex;
}
};
......@@ -9,9 +9,9 @@
<script src="./cesium/Cesium.js"></script>
<script src="./js/icontfont.js"></script>
<script type="text/javascript" src="./js/nipplejs.min.js"></script>
<script src="js/PIMediaPlayer_api.js"></script>
<script src="./s3m.js"></script>
<script type="text/javascript" src="js/kbt_api.js"></script>
<script src="QingLiu/PIMediaPlayer_api.js"></script>
<script type="text/javascript" src="QingLiu/kbt_api.js"></script>
<script src="liveplayer/liveplayer-lib.min.js"></script>
</head>
<body>
......
......@@ -3,9 +3,9 @@ export default `
1.清流需要网站响应头中添加
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
2.需要将mmc-stl-vue2/components/MMCPlayer/lib/js和mmc-stl-vue2/components/MMCPlayer/lib/liveplayer复制到项目的public文件中, index.html添加以下代码
<script src="js/PIMediaPlayer_api.js"></script>
<script src="js/kbt_api.js"></script>
2.需要将mmc-stl-vue2/components/MMCPlayer/lib/QingLiu和mmc-stl-vue2/components/MMCPlayer/lib/liveplayer复制到项目的public文件中, index.html添加以下代码
<script src="QingLiu/PIMediaPlayer_api.js"></script>
<script src="QingLiu/kbt_api.js"></script>
<script src="liveplayer/liveplayer-lib.min.js"></script>
<template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论