From caa32fa2486f53d5bf814cfe289b8bab66bc1038 Mon Sep 17 00:00:00 2001 From: Aaron Ogle Date: Tue, 5 Jan 2021 00:30:18 -0600 Subject: [PATCH] make websocket and stream use constants (#584) --- webroot/js/components/player.js | 3 +-- webroot/js/utils/websocket.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/webroot/js/components/player.js b/webroot/js/components/player.js index bcab2fa4a..60a257671 100644 --- a/webroot/js/components/player.js +++ b/webroot/js/components/player.js @@ -3,10 +3,9 @@ import videojs from '/js/web_modules/videojs/core.js'; import '/js/web_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js'; import { getLocalStorage, setLocalStorage } from '../utils/helpers.js'; -import { PLAYER_VOLUME } from '../utils/constants.js'; +import { PLAYER_VOLUME, URL_STREAM } from '../utils/constants.js'; const VIDEO_ID = 'video'; -const URL_STREAM = `/hls/stream.m3u8`; // Video setup const VIDEO_SRC = { diff --git a/webroot/js/utils/websocket.js b/webroot/js/utils/websocket.js index 57f0598fb..83293828f 100644 --- a/webroot/js/utils/websocket.js +++ b/webroot/js/utils/websocket.js @@ -1,3 +1,4 @@ +import { URL_WEBSOCKET } from './constants.js'; /** * These are the types of messages that we can handle with the websocket. * Mostly used by `websocket.js` but if other components need to handle @@ -17,7 +18,6 @@ export const CALLBACKS = { WEBSOCKET_DISCONNECTED: 'websocketDisconnected', } -const URL_WEBSOCKET = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/entry`; const TIMER_WEBSOCKET_RECONNECT = 5000; // ms export default class Websocket {