Skip to content

Commit

Permalink
Update appCastUrl; Dispose all player instances before executing any …
Browse files Browse the repository at this point in the history
…installing process;
  • Loading branch information
bdlukaa committed Aug 11, 2023
1 parent d402969 commit b0c4778
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/providers/update_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import 'package:http/http.dart' as http;
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
import 'package:unity_video_player/unity_video_player.dart';
import 'package:version/version.dart';
import 'package:window_manager/window_manager.dart';
import 'package:xml/xml.dart';
Expand Down Expand Up @@ -87,7 +88,7 @@ class UpdateManager extends ChangeNotifier {

/// The URL to the appcast file.
static const appCastUrl =
'https://raw.githubusercontent.com/bdlukaa/unity/upgrade/bluecherry_appcast.xml';
'https://raw.githubusercontent.com/bluecherrydvr/unity/main/bluecherry_appcast.xml';

/// Initializes the [UpdateManager] instance & fetches state from `async`
/// `package:hive` method-calls. Called before [runApp].
Expand Down Expand Up @@ -314,8 +315,7 @@ class UpdateManager extends ChangeNotifier {
'This should never be reached on unsupported platforms',
);

// TODO(bdlukaa): Introduce this on ready-to-review PR
// assert(latestVersion.version != packageInfo.version, 'Already up to date');
assert(latestVersion.version != packageInfo.version, 'Already up to date');

final executable = executableFor(latestVersion.version);
assert(executable != null, 'Executable not found');
Expand All @@ -326,6 +326,7 @@ class UpdateManager extends ChangeNotifier {
}

windowManager.hide();
await UnityVideoPlayerInterface.dispose();

if (Platform.isWindows) {
// https://jrsoftware.org/ishelp/index.php?topic=technotes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ abstract class UnityVideoPlayerInterface extends PlatformInterface {
static void unregisterPlayer(UnityVideoPlayer player) {
_appPlayers.remove(player);
}

/// Diposes all the player instances
static Future<void> dispose() {
return Future.microtask(() async {
for (final player in UnityVideoPlayerInterface.players.toList()) {
debugPrint('Disposing player ${player.hashCode}');
await player.dispose();
}
});
}
}

typedef VideoViewInheritance = _UnityVideoView;
Expand Down

0 comments on commit b0c4778

Please sign in to comment.