Revert "send 10 percent of traffic to other server"
This reverts commit 0fcdbc7858
.
This commit is contained in:
parent
63a4a597a9
commit
e40b65b975
1 changed files with 7 additions and 34 deletions
|
@ -164,10 +164,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
|
|
||||||
const playerServerRef = useRef();
|
const playerServerRef = useRef();
|
||||||
|
|
||||||
const livestreamVideoUrl = activeLivestreamForChannel?.url;
|
const { url: livestreamVideoUrl } = activeLivestreamForChannel || {};
|
||||||
|
const showQualitySelector = !isLivestreamClaim || (livestreamVideoUrl && livestreamVideoUrl.includes('/transcode/'));
|
||||||
// show quality selector if not a livestream, or a transcoded livestream
|
|
||||||
const showQualitySelector = !isLivestreamClaim || livestreamVideoUrl?.includes('/transcode/');
|
|
||||||
|
|
||||||
// initiate keyboard shortcuts
|
// initiate keyboard shortcuts
|
||||||
const { curried_function } = keyboardShorcuts({
|
const { curried_function } = keyboardShorcuts({
|
||||||
|
@ -333,18 +331,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
}
|
}
|
||||||
}, [showQualitySelector]);
|
}, [showQualitySelector]);
|
||||||
|
|
||||||
function hitsTenPercent() {
|
|
||||||
// from 0 - 999
|
|
||||||
const rand = Math.floor(Math.random() * (1000 + 1));
|
|
||||||
|
|
||||||
// 499 is 50% chance of running
|
|
||||||
if (rand < 100) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** instantiate videoJS and dispose of it when done with code **/
|
/** instantiate videoJS and dispose of it when done with code **/
|
||||||
// This lifecycle hook is only called once (on mount), or when `isAudio` or `source` changes.
|
// This lifecycle hook is only called once (on mount), or when `isAudio` or `source` changes.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -371,28 +357,15 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
const controlBar = document.querySelector('.vjs-control-bar');
|
const controlBar = document.querySelector('.vjs-control-bar');
|
||||||
if (controlBar) controlBar.style.setProperty('opacity', '1', 'important');
|
if (controlBar) controlBar.style.setProperty('opacity', '1', 'important');
|
||||||
|
|
||||||
// if livestream
|
|
||||||
if (isLivestreamClaim && userClaimId) {
|
if (isLivestreamClaim && userClaimId) {
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
vjsPlayer.addClass('livestreamPlayer');
|
vjsPlayer.addClass('livestreamPlayer');
|
||||||
|
|
||||||
const newLivestreamServer = 'https://cdn-backup.odysee.live';
|
// $FlowFixMe
|
||||||
const newLivestreamUrl = newLivestreamServer + livestreamVideoUrl.substr(23);
|
vjsPlayer.src({
|
||||||
|
type: 'application/x-mpegURL',
|
||||||
// run if a 10% chance happens
|
src: livestreamVideoUrl,
|
||||||
if (hitsTenPercent()) {
|
});
|
||||||
// $FlowFixMe
|
|
||||||
vjsPlayer.src({
|
|
||||||
type: 'application/x-mpegURL',
|
|
||||||
src: newLivestreamUrl,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// $FlowFixMe
|
|
||||||
vjsPlayer.src({
|
|
||||||
type: 'application/x-mpegURL',
|
|
||||||
src: livestreamVideoUrl,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
vjsPlayer.removeClass('livestreamPlayer');
|
vjsPlayer.removeClass('livestreamPlayer');
|
||||||
|
|
Loading…
Reference in a new issue