Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Refactor player button to fix Safari issues. Closes #2440
Gabe Kangas21de86e77698
diff --git a/web/components/video/OwncastPlayer/OwncastPlayer.tsx b/web/components/video/OwncastPlayer/OwncastPlayer.tsxindex 9d25c97ed7..4d5733fbf6 100644--- a/web/components/video/OwncastPlayer/OwncastPlayer.tsx+++ b/web/components/video/OwncastPlayer/OwncastPlayer.tsx@@ -160,15 +160,14 @@ export const OwncastPlayer: FC<OwncastPlayerProps> = ({ source, online }) => {const setupAirplay = (player, videojs) => {// eslint-disable-next-line no-prototype-builtinsif (window.hasOwnProperty('WebKitPlaybackTargetAvailabilityEvent')) {- const videoJsButtonClass = videojs.getComponent('Button');- const ConcreteButtonClass = videojs.extend(videoJsButtonClass, {- // The `init()` method will also work for constructor logic here, but it is- // deprecated. If you provide an `init()` method, it will override the- // `constructor()` method!+ const VJSButtonClass = videojs.getComponent('Button');++ class ConcreteButtonClass extends VJSButtonClass {constructor() {- videoJsButtonClass.call(this, player);- },+ super(player);+ }+ // eslint-disable-next-line class-methods-use-thishandleClick() {try {const videoElement = document.getElementsByTagName('video')[0];@@ -176,10 +175,11 @@ export const OwncastPlayer: FC<OwncastPlayerProps> = ({ source, online }) => {} catch (e) {console.error(e);}- },- });+ }+ }- const concreteButtonInstance = player.controlBar.addChild(new ConcreteButtonClass());+ const ccbc = new ConcreteButtonClass();+ const concreteButtonInstance = player.controlBar.addChild(ccbc);concreteButtonInstance.addClass('vjs-airplay');}};diff --git a/web/components/video/settings-menu.ts b/web/components/video/settings-menu.tsindex 8341e9c5c5..badafbaf19 100644--- a/web/components/video/settings-menu.ts+++ b/web/components/video/settings-menu.ts@@ -92,17 +92,20 @@ export function createVideoSettingsMenuButton(player, videojs, qualities, latenc}}+ const menuButton = new MenuButton();+// If none of the settings in this menu are applicable then don't show it.const tech = player.tech({ IWillNotUseThisInPlugins: true });+ menuButton.addClass('vjs-quality-selector');+ videojs.registerComponent('MenuButton', MenuButton);- if (qualities.length < 2 && (!tech || !tech.vhs)) {- return;+ if (!tech.vhs) {+ return menuButton;}- videojs.registerComponent('MenuButton', MenuButton);-- const menuButton = new MenuButton();- menuButton.addClass('vjs-quality-selector');+ if (qualities.length < 2 && (!tech || !tech.vhs)) {+ return menuButton;+ }// eslint-disable-next-line consistent-returnreturn menuButton;