Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move more playback code to rust #42

Merged
merged 7 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/native/api/player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<AnnixPlayer>>
abstract class AnnixPlayer implements RustOpaqueInterface {
Future<void> addProvider(
{required String url, required String auth, required int priority});

Future<void> clearProvider();

bool isPlaying();

factory AnnixPlayer() => RustLib.instance.api.crateApiPlayerAnnixPlayerNew();
factory AnnixPlayer({required String cachePath}) =>
RustLib.instance.api.crateApiPlayerAnnixPlayerNew(cachePath: cachePath);

Future<void> open(
{required String identifier, required AudioQuality quality});

Future<void> openFile({required String path});

Expand All @@ -26,11 +35,22 @@ abstract class AnnixPlayer implements RustOpaqueInterface {

Future<void> seek({required int position});

Future<void> setTrack(
{required String identifier, required AudioQuality quality});

Future<void> setVolume({required double volume});

Future<void> stop();
}

enum AudioQuality {
low,
medium,
high,
lossless,
;
}

enum PlayerStateEvent {
/// Started playing
play,
Expand Down
Loading