Optimize index file code format
This commit is contained in:
parent
5e9ddf64c3
commit
eeb2eadf0a
|
|
@ -270,19 +270,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function on_click_to_play(app, stream) {
|
function on_click_to_play(app, stream) {
|
||||||
console.log(`on_click_to_play: ${app}/${stream}`);
|
console.log(`on_click_to_play: ${app}/${stream}`);
|
||||||
var url = `${document.location.protocol}//${window.location.host}/index/api/webrtc?app=${app}&stream=${stream}&type=play`;
|
var url = `${document.location.protocol}//${window.location.host}/index/api/webrtc?app=${app}&stream=${stream}&type=play`;
|
||||||
document.getElementById('streamUrl').value = url;
|
document.getElementById('streamUrl').value = url;
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearStreamList() {
|
function clearStreamList() {
|
||||||
let content = document.getElementById("olstreamlist");
|
let content = document.getElementById("olstreamlist");
|
||||||
while (content.hasChildNodes()) {
|
while (content.hasChildNodes()) {
|
||||||
content.removeChild(content.firstChild);
|
content.removeChild(content.firstChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillStreamList(json) {
|
function fillStreamList(json) {
|
||||||
clearStreamList();
|
clearStreamList();
|
||||||
if (json.code != 0 || !json.data) {
|
if (json.code != 0 || !json.data) {
|
||||||
|
|
@ -311,6 +312,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getData(url) {
|
async function getData(url) {
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
|
|
@ -319,11 +321,13 @@
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_media_list() {
|
function get_media_list() {
|
||||||
let url = document.location.protocol+"//"+window.location.host+"/index/api/getMediaList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc";
|
let url = document.location.protocol+"//"+window.location.host+"/index/api/getMediaList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc";
|
||||||
let json = getData(url);
|
let json = getData(url);
|
||||||
json.then((json)=> fillStreamList(json));
|
json.then((json)=> fillStreamList(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
// get_media_list();
|
// get_media_list();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue