Skip to content

Commit

Permalink
core: disable yt video stream switching if cached version was playing
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Mar 24, 2024
1 parent 5ee66a1 commit 831258a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/base/audio_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
final currentCachedVideo = Rxn<NamidaVideo>();
final currentCachedAudio = Rxn<AudioCacheDetails>();

final _allowSwitchingVideoStreamIfCachedPlaying = false;

bool get isFetchingInfo => _isFetchingInfo.value;
final _isFetchingInfo = false.obs;

Expand Down Expand Up @@ -910,7 +912,11 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
streams.audioOnlyStreams?.firstOrNull;
if (prefferedAudioStream?.url != null || prefferedVideoStream?.url != null) {
final cachedVideoSet = playedFromCacheDetails.video;
final isStreamRequiredBetterThanCachedSet = cachedVideoSet == null ? true : (prefferedVideoStream?.width ?? 0) > (cachedVideoSet.width);
bool isStreamRequiredBetterThanCachedSet = cachedVideoSet == null
? true
: _allowSwitchingVideoStreamIfCachedPlaying
? (prefferedVideoStream?.width ?? 0) > (cachedVideoSet.width)
: false;

currentVideoStream.value = isAudioOnlyPlayback
? null
Expand Down

0 comments on commit 831258a

Please sign in to comment.