Merge pull request #202 from UniversityRadioYork/mstratford/tracklist-patch
This commit is contained in:
commit
2790e0a20c
2 changed files with 18 additions and 0 deletions
|
@ -382,6 +382,13 @@ export const load = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If somehow we've managed to re-load the channel without ending tracklisting.
|
||||||
|
// This could happen if they paused it at the end, or if Wavesurfer forgot somehow.
|
||||||
|
const tracklistItemID = getState().mixer.players[player].tracklistItemID;
|
||||||
|
if (tracklistItemID !== -1) {
|
||||||
|
dispatch(BroadcastState.tracklistEnd(tracklistItemID));
|
||||||
|
}
|
||||||
|
|
||||||
// Can't really load a ghost, it'll break setting cues etc. Do nothing.
|
// Can't really load a ghost, it'll break setting cues etc. Do nothing.
|
||||||
if (item.type === "ghost") {
|
if (item.type === "ghost") {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import * as ShowPlanState from "../showplanner/state";
|
||||||
import { HHMMTosec, secToHHMM, timestampToHHMM } from "../lib/utils";
|
import { HHMMTosec, secToHHMM, timestampToHHMM } from "../lib/utils";
|
||||||
import ProModeButtons from "./ProModeButtons";
|
import ProModeButtons from "./ProModeButtons";
|
||||||
import { VUMeter } from "../optionsMenu/helpers/VUMeter";
|
import { VUMeter } from "../optionsMenu/helpers/VUMeter";
|
||||||
|
import * as BroadcastState from "../broadcast/state";
|
||||||
import * as api from "../api";
|
import * as api from "../api";
|
||||||
import { AppThunk } from "../store";
|
import { AppThunk } from "../store";
|
||||||
import {
|
import {
|
||||||
|
@ -24,6 +25,7 @@ import {
|
||||||
PLAYER_COUNT,
|
PLAYER_COUNT,
|
||||||
PLAYER_ID_PREVIEW,
|
PLAYER_ID_PREVIEW,
|
||||||
} from "../mixer/audio";
|
} from "../mixer/audio";
|
||||||
|
import { useBeforeunload } from "react-beforeunload";
|
||||||
|
|
||||||
export const USE_REAL_GAIN_VALUE = false;
|
export const USE_REAL_GAIN_VALUE = false;
|
||||||
|
|
||||||
|
@ -269,6 +271,15 @@ export function Player({
|
||||||
omit(b, "timeCurrent", "timeRemaining")
|
omit(b, "timeCurrent", "timeRemaining")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useBeforeunload((event) => {
|
||||||
|
console.log("Checking player " + id + " for un-ended tracklists.");
|
||||||
|
const tracklistItemID = playerState.tracklistItemID;
|
||||||
|
if (tracklistItemID !== -1) {
|
||||||
|
dispatch(BroadcastState.tracklistEnd(tracklistItemID));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const settings = useSelector((state: RootState) => state.settings);
|
const settings = useSelector((state: RootState) => state.settings);
|
||||||
const customOutput = settings.channelOutputIds[id] !== INTERNAL_OUTPUT_ID;
|
const customOutput = settings.channelOutputIds[id] !== INTERNAL_OUTPUT_ID;
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
Loading…
Reference in a new issue