From a690a05a17bf04e74e9746a3df1e9bec4b35f9a9 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Wed, 3 Jun 2020 13:36:39 -0600 Subject: work even further around weird georgia stuff --- dist/script.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'dist/script.js') diff --git a/dist/script.js b/dist/script.js index 67e3545..8d803b8 100644 --- a/dist/script.js +++ b/dist/script.js @@ -110,7 +110,11 @@ function makeCameraStream(camera) { video.controls = true; if (Hls.isSupported()) { const hls = new Hls({manifestLoadingTimeOut: 60000}); - hls.loadSource(camera.stream); + if (location.hostname === 'localhost' && camera.stream.startsWith('/')) { + hls.loadSource('https://pig.observer' + camera.stream); + } else { + hls.loadSource(camera.stream); + } hls.attachMedia(video); hls.on(Hls.Events.MANIFEST_PARSED, function () { video.play(); @@ -164,6 +168,9 @@ function makeCameraStream(camera) { // listened-for when the URL is not on the white-list is 'loadedmetadata'. else if (video.canPlayType("application/vnd.apple.mpegurl")) { video.src = camera.stream; + if (location.hostname === 'localhost' && camera.stream.startsWith('/')) { + video.src = 'https://pig.observer' + camera.stream; + } video.addEventListener("loadedmetadata", function () { video.play(); }); -- cgit v1.2.3