Skip to content

Commit

Permalink
fix web
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed May 21, 2023
1 parent 6f60658 commit 9bd9c66
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 18 deletions.
1 change: 1 addition & 0 deletions package/play/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class _MainPageState extends State<MainPage> {
max: media_controller.getDurationMax().inMicroseconds.toDouble(),
value: media_controller.getDurationPosition().inMicroseconds.toDouble(),
onChanged: (double value) async {

await media_controller.seek(Duration(microseconds: value.toInt()));
setState(() {});
},
Expand Down
32 changes: 27 additions & 5 deletions package/play/lib/media_kit/media_kit_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class Player {
return 0;
}

PlayerState get state {
return PlayerState();
}

PlayerStreams get streams {
return PlayerStreams();
}

seek(Duration) async {}
pause() async {}
play() async {}
Expand All @@ -25,10 +33,24 @@ class Media {
Media(String path);
}


class MediaKit {

static void ensureInitialized({String? libmpv}) {

static void ensureInitialized({String? libmpv}) {}
}

class PlayerState {
Duration get duration {
return Duration();
}
}
Duration get position {
return Duration();
}
}

class PlayerStreams {
Duration get duration {
return Duration();
}
Stream<Duration> get position {
return Future(() => Duration()).asStream();
}
}
4 changes: 2 additions & 2 deletions package/play/lib/media_kit_video/media_kit_video.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// export "media_kit_video_web.dart";

export "media_kit_video_app.dart"
if (dart.library.html) "media_kit_video_web.dart";
export "media_kit_video_app.dart" if (dart.library.html) "media_kit_video_web.dart";

3 changes: 2 additions & 1 deletion package/play/lib/media_kit_video/media_kit_video_web.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:play/media_kit/media_kit_web.dart';

class VideoController {
VideoController();
static Future<VideoController> create(Future<int> handle) async {
static Future<VideoController> create(Player handle) async {
return VideoController();
}

Expand Down
5 changes: 2 additions & 3 deletions package/play/lib/src/media.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ extension MediaControllerExtensions on MediaController {
}
if (isDesktop) {
return desktop_player.streams.position.last;
// return (await desktop_player.positionStream.last).position ?? Duration();
} else if (isMobile) {
} else if (isMobile) {
return (await mobilePlayer.position) ?? Duration();
}
return Duration();
Expand All @@ -50,7 +49,7 @@ extension MediaControllerExtensions on MediaController {
/// if you want tutorial please check [Youtube](https://youtube.com/@azkadev)
Stream? streamDurationPosition() {
if (!is_init) {
return Stream.value("ok");
return Stream.value(Duration(milliseconds: 1));
}
if (isDesktop) {
return desktop_player.streams.position;
Expand Down
64 changes: 64 additions & 0 deletions package/play/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.0.7+1"
media_kit_libs_android_audio:
dependency: "direct main"
description:
name: media_kit_libs_android_audio
sha256: e48686a62394514faae4c63ae811bc239221039cb5a5212b98c74a66709f3c0d
url: "https://pub.dev"
source: hosted
version: "1.0.3"
media_kit_libs_android_video:
dependency: "direct main"
description:
name: media_kit_libs_android_video
sha256: b80aad84e038cdb641b941cefc2a7e9366881d19a14292f613c32ae6ec810e40
url: "https://pub.dev"
source: hosted
version: "1.0.3"
media_kit_libs_ios_audio:
dependency: "direct main"
description:
name: media_kit_libs_ios_audio
sha256: bb18ed87e8a155fc1d2ee4bf59462ca04d02a0eeb38d0b454facee6d32441ce7
url: "https://pub.dev"
source: hosted
version: "1.0.4"
media_kit_libs_ios_video:
dependency: "direct main"
description:
name: media_kit_libs_ios_video
sha256: "28c6ddd5ed43263641293832c8d1fb3f24af81b4eba0b61d6da9bedadbf2e1b1"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
media_kit_libs_linux:
dependency: "direct main"
description:
name: media_kit_libs_linux
sha256: "21acc71cbae3518b3aeef9023a6a3a3decb579a40153764333814987ccd61040"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
media_kit_libs_macos_audio:
dependency: "direct main"
description:
name: media_kit_libs_macos_audio
sha256: b9f4a2995396fd5cc243901e618c0586d4f1781eecf2302999b77d6faee8b250
url: "https://pub.dev"
source: hosted
version: "1.0.5"
media_kit_libs_macos_video:
dependency: "direct main"
description:
name: media_kit_libs_macos_video
sha256: c4d3706af5a67bf194d8208eef5cf29ea79e64931ea9bcd50f665b9a438f8416
url: "https://pub.dev"
source: hosted
version: "1.0.5"
media_kit_libs_windows_audio:
dependency: "direct main"
description:
Expand All @@ -267,6 +323,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.2"
media_kit_native_event_loop:
dependency: "direct main"
description:
name: media_kit_native_event_loop
sha256: ed87140ad4b64156b2b470c8105f48d8cad7923c952ca05d23e02d28978d2cb3
url: "https://pub.dev"
source: hosted
version: "1.0.3"
media_kit_video:
dependency: "direct main"
description:
Expand Down
10 changes: 3 additions & 7 deletions package/play/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ platforms:
web:

environment:
sdk: '>=2.19.0 <3.0.0'
sdk: '>=2.19.0 <4.0.0'

dev_dependencies:
lints: ^2.1.0
Expand All @@ -29,16 +29,12 @@ dependencies:
media_kit_video: ^0.0.9
galaxeus_lib: ^0.0.66
media_kit_libs_windows_video: ^1.0.2
media_kit_libs_windows_audio: ^1.0.3


media_kit_libs_windows_audio: ^1.0.3
media_kit_native_event_loop: ^1.0.3 # Support for higher number of concurrent instances & better performance.

media_kit_libs_android_video: ^1.0.3 # Android package for video native libraries.
media_kit_libs_ios_video: ^1.0.4 # iOS package for video native libraries.
media_kit_libs_macos_video: ^1.0.5 # macOS package for video native libraries.
media_kit_libs_linux: ^1.0.2

media_kit_libs_linux: ^1.0.2
media_kit_libs_android_audio: ^1.0.3 # Android package for audio native libraries.
media_kit_libs_ios_audio: ^1.0.4 # iOS package for audio native libraries.
media_kit_libs_macos_audio: ^1.0.5
Expand Down

0 comments on commit 9bd9c66

Please sign in to comment.