aboutsummaryrefslogtreecommitdiff
path: root/dist/script.js
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-06-03 13:36:39 -0600
committerMelody Horn <melody@boringcactus.com>2020-06-03 13:36:39 -0600
commita690a05a17bf04e74e9746a3df1e9bec4b35f9a9 (patch)
treebf3cd2ef29a168fee6db7ed7535729f270e6b3db /dist/script.js
parent1fb51437daf96f89546e084fdebec6b534108cc3 (diff)
downloadpig.observer-a690a05a17bf04e74e9746a3df1e9bec4b35f9a9.tar.gz
pig.observer-a690a05a17bf04e74e9746a3df1e9bec4b35f9a9.zip
work even further around weird georgia stuff
Diffstat (limited to 'dist/script.js')
-rw-r--r--dist/script.js9
1 files changed, 8 insertions, 1 deletions
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();
});