1const apisecret = "65586c9ba88ef"; 2const aliases = ["cam128", "cam231", "cam38", "cam053", "cam6", "cam88"]; 3 4async function getStreamHlsUrl(alias) { 5 const response = await fetch("https://ipcamlive.com/api/v2/getstreamhlsurl?apisecret=" + apisecret + "&alias=" + alias); 6 const data = await response.json(); 7 8 if (data.result === "err") { 9 // console.log(data); 10 return; 11 } 12 13 let url = data.data.url; 14 url = url.replace("http://", "https://"); 15 const video = document.getElementById(alias); 16 17 // HLS.js is not supported on platforms that do not have Media Source 18 // Extensions (MSE) enabled. 19 // 20 // When the browser has built-in HLS support (check using `canPlayType`), 21 // we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video 22 // element through the `src` property. This is using the built-in support 23 // of the plain video element, without using HLS.js. 24 25 if (video.canPlayType('application/vnd.apple.mpegurl')) { 26 console.log("load video src"); 27 video.src = url; 28 } else if (Hls.isSupported()) { 29 console.log("load hls"); 30 var hls = new Hls(); 31 hls.loadSource(url); 32 hls.attachMedia(video); 33 } 34} 35 36async function getSnapshotUrl(alias) { 37 const response = await fetch("https://ipcamlive.com/api/v2/getsnapshoturl?apisecret=" + apisecret + "&alias=" + alias); 38 const data = await response.json(); 39 const video = document.getElementById(alias); 40 41 if (data.result === "err") { 42 // console.log(data); 43 44 const baseURL = "https://" + window.location.hostname + "/wp-content/themes/aodos/assets/img/cameras/"; 45 const fileName = alias + "-snapshot.jpg"; 46 const staticPoster = baseURL + fileName; 47 48 video.setAttribute("poster", staticPoster); 49 50 return; 51 } 52 53 let url = data.data.url; 54 url = url.replace("http://", "https://"); 55 video.setAttribute("poster", url); 56} 57 58// fetch cameras 59aliases.forEach((alias) => { 60 getSnapshotUrl(alias); 61 getStreamHlsUrl(alias); 62});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.