Workaround for video issues on iOS (fix #859)

This commit is contained in:
dangered wolf 2024-08-03 23:22:15 -07:00
parent 88943830db
commit b09e5909a2
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
2 changed files with 12 additions and 1 deletions

View file

@ -4,7 +4,8 @@ export enum Experiment {
TWEET_DETAIL_API = 'TWEET_DETAIL_API',
DISCORD_NATIVE_MULTI_IMAGE = 'DISCORD_NATIVE_MULTI_IMAGE',
TRANSCODE_GIFS = 'TRANSCODE_GIFS',
IV_FORCE_THREAD_UNROLL = 'IV_FORCE_THREAD_UNROLL'
IV_FORCE_THREAD_UNROLL = 'IV_FORCE_THREAD_UNROLL',
DISCORD_VIDEO_REDIRECT_WORKAROUND = 'DISCORD_VIDEO_REDIRECT_WORKAROUND'
}
type ExperimentConfig = {
@ -43,6 +44,11 @@ const Experiments: { [key in Experiment]: ExperimentConfig } = {
name: 'IV force thread unroll',
description: 'Force thread unroll for Telegram Instant View',
percentage: 1
},
[Experiment.DISCORD_VIDEO_REDIRECT_WORKAROUND]: {
name: 'Video redirect workaround',
description: 'Workaround for video playback issues on Discord',
percentage: 1
}
};

View file

@ -62,6 +62,11 @@ export const renderVideo = (
`https://${Constants.GIF_TRANSCODE_DOMAIN}`
);
console.log('We passed checks for transcoding GIFs, feeding embed url', url);
} else if (
userAgent?.includes('Discord') &&
experimentCheck(Experiment.DISCORD_VIDEO_REDIRECT_WORKAROUND, !!Constants.API_HOST_LIST)
) {
url = `https://${Constants.API_HOST_LIST[0]}/2/hit?url=${encodeURIComponent(url)}`;
}
/* Push the raw video-related headers */