refactor: simplify player classes

This commit is contained in:
edde746
2025-12-02 17:20:59 +01:00
parent 6d9a56fa73
commit 73eda7c918
6 changed files with 8 additions and 33 deletions
@@ -1,6 +1,6 @@
import 'package:flutter/services.dart';
import 'player_native.dart';
import '../player_native.dart';
/// Linux implementation of [Player].
///
@@ -1,6 +1,6 @@
import 'package:flutter/services.dart';
import 'player_native.dart';
import '../player_native.dart';
/// Windows implementation of [Player].
///
+6 -16
View File
@@ -4,14 +4,12 @@ import '../models/audio_device.dart';
import '../models/media.dart';
import '../models/audio_track.dart';
import '../models/subtitle_track.dart';
import 'player_android.dart';
import 'player_ios.dart';
import 'player_linux.dart';
import 'player_macos.dart';
import 'player_native.dart';
import 'player_state.dart';
import 'player_streams.dart';
import 'player_stub.dart';
import 'player_windows.dart';
import 'platform/player_linux.dart';
import 'platform/player_windows.dart';
/// Abstract interface for the video player.
///
@@ -197,21 +195,13 @@ abstract class Player {
/// Creates a new player instance.
///
/// Returns a platform-specific implementation:
/// - macOS: [PlayerMacOS] using MPVKit with Metal rendering
/// - iOS: [PlayerIOS] using MPVKit with Metal rendering
/// - Android: [PlayerAndroid] using libmpv
/// - macOS/iOS/Android: [PlayerNative] using MPVKit/libmpv with texture rendering
/// - Windows: [PlayerWindows] using libmpv with native window embedding
/// - Linux: [PlayerLinux] using libmpv with OpenGL rendering via GtkGLArea
/// - Other platforms: [PlayerStub] (placeholder)
factory Player() {
if (Platform.isMacOS) {
return PlayerMacOS();
}
if (Platform.isIOS) {
return PlayerIOS();
}
if (Platform.isAndroid) {
return PlayerAndroid();
if (Platform.isMacOS || Platform.isIOS || Platform.isAndroid) {
return PlayerNative();
}
if (Platform.isWindows) {
return PlayerWindows();
-5
View File
@@ -1,5 +0,0 @@
import 'player_native.dart';
/// Android implementation of Player.
/// Inherits all functionality from PlayerNative.
class PlayerAndroid extends PlayerNative {}
-5
View File
@@ -1,5 +0,0 @@
import 'player_native.dart';
/// iOS implementation of Player.
/// Inherits all functionality from PlayerNative.
class PlayerIOS extends PlayerNative {}
-5
View File
@@ -1,5 +0,0 @@
import 'player_native.dart';
/// macOS implementation of Player.
/// Inherits all functionality from PlayerNative.
class PlayerMacOS extends PlayerNative {}