Skip to content

Commit

Permalink
chore: add yt flag to force refresh js player
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Sep 27, 2024
1 parent 96ac21b commit a6a6804
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ jobs:
done <<< "$COMMITS"
# Encode special characters
CHANGELOG="${CHANGELOG//$'%'/%25}"
CHANGELOG="${CHANGELOG//$'\n'/%0A}"
CHANGELOG="${CHANGELOG//$'\r'/%0D}"
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "CHANGELOG=$CHANGELOG" >> $GITHUB_ENV
- name: Creating Snapshot Release at namida-snapshots
Expand Down
11 changes: 11 additions & 0 deletions lib/ui/widgets/settings/youtube_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:namida/core/translations/language.dart';
import 'package:namida/core/utils.dart';
import 'package:namida/ui/widgets/custom_widgets.dart';
import 'package:namida/ui/widgets/settings_card.dart';
import 'package:namida/youtube/controller/youtube_info_controller.dart';
import 'package:namida/youtube/controller/yt_miniplayer_ui_controller.dart';
import 'package:namida/youtube/pages/user/youtube_account_manage_page.dart';

Expand Down Expand Up @@ -583,6 +584,8 @@ class _YTFlagsOptions extends StatefulWidget {
}

class __YTFlagsOptionsState extends State<_YTFlagsOptions> {
bool didRefreshJsPlayer = false;

@override
Widget build(BuildContext context) {
return SizedBox(
Expand Down Expand Up @@ -651,6 +654,14 @@ class __YTFlagsOptionsState extends State<_YTFlagsOptions> {
onChanged: (isTrue) => setState(() => settings.youtube.save(enableDimInLightMode: !isTrue)),
title: 'enable_dim_in_light_mode'.toUpperCase(),
),
CustomListTile(
enabled: !didRefreshJsPlayer,
title: 'refresh_js_player'.toUpperCase(),
onTap: () {
setState(() => didRefreshJsPlayer = true);
YoutubeInfoController.video.forceRefreshJSPlayer();
},
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class _VideoInfoController {
return YoutiPie.cipher.prepareJSPlayer(cacheDirectoryPath: AppDirs.YOUTIPIE_CACHE);
}

Future<bool> forceRefreshJSPlayer() async {
return YoutiPie.cipher.forceRefreshJSPlayer(cacheDirectoryPath: AppDirs.YOUTIPIE_CACHE);
}

Future<YoutiPieVideoPageResult?> fetchVideoPage(String videoId, {ExecuteDetails? details}) async {
final relatedVideosParams = YoutubeInfoController.current._relatedVideosParams;
final res = await YoutiPie.video.fetchVideoPage(videoId: videoId, relatedVideosParams: relatedVideosParams, details: details);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: namida
description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter
publish_to: "none"
version: 4.4.9-beta+240926220
version: 4.5.0-beta+240927153

environment:
sdk: ">=3.4.0 <4.0.0"
Expand Down

0 comments on commit a6a6804

Please sign in to comment.