diff --git a/www/webrtc/index.html b/www/webrtc/index.html index d4eb1776..0ff074f4 100644 --- a/www/webrtc/index.html +++ b/www/webrtc/index.html @@ -18,11 +18,19 @@ -
- +
@@ -252,6 +260,64 @@ } } + + function 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`; + document.getElementById('streamUrl').value = url; + start(); + } + function clearStreamList() { + let content = document.getElementById("olstreamlist"); + while (content.hasChildNodes()) { + content.removeChild(content.firstChild); + } + } + function fillStreamList(json) { + clearStreamList(); + if (json.code != 0) { + return; + } + let ss = {}; + for (let o of json.data) { + if (ss[o.app]) { + ss[o.app].add(o.stream); + } else { + let set = new Set(); + set.add(o.steram); + ss[o.app] = set; + } + } + + for (let o in ss) { + let app = o; + for (let s of ss[o]) { + if (s) { + //console.log(app, s); + let content = document.getElementById("olstreamlist"); + let child = `