mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
refactor(windows,linux): replace audioplayers with media_kit
This commit is contained in:
parent
33cb7947d6
commit
06f6adc69c
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
import 'package:audio_service_web/audio_service_web.dart';
|
import 'package:audio_service_web/audio_service_web.dart';
|
||||||
import 'package:audio_session/audio_session_web.dart';
|
import 'package:audio_session/audio_session_web.dart';
|
||||||
import 'package:audioplayers_web/audioplayers_web.dart';
|
|
||||||
import 'package:file_picker/_internal/file_picker_web.dart';
|
import 'package:file_picker/_internal/file_picker_web.dart';
|
||||||
import 'package:shared_preferences_web/shared_preferences_web.dart';
|
import 'package:shared_preferences_web/shared_preferences_web.dart';
|
||||||
import 'package:url_launcher_web/url_launcher_web.dart';
|
import 'package:url_launcher_web/url_launcher_web.dart';
|
||||||
@ -19,7 +18,6 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
|||||||
void registerPlugins(Registrar registrar) {
|
void registerPlugins(Registrar registrar) {
|
||||||
AudioServiceWeb.registerWith(registrar);
|
AudioServiceWeb.registerWith(registrar);
|
||||||
AudioSessionWeb.registerWith(registrar);
|
AudioSessionWeb.registerWith(registrar);
|
||||||
AudioplayersPlugin.registerWith(registrar);
|
|
||||||
FilePickerWeb.registerWith(registrar);
|
FilePickerWeb.registerWith(registrar);
|
||||||
SharedPreferencesPlugin.registerWith(registrar);
|
SharedPreferencesPlugin.registerWith(registrar);
|
||||||
UrlLauncherPlugin.registerWith(registrar);
|
UrlLauncherPlugin.registerWith(registrar);
|
||||||
|
@ -11,6 +11,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:media_kit/media_kit.dart';
|
||||||
import 'package:metadata_god/metadata_god.dart';
|
import 'package:metadata_god/metadata_god.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
@ -75,6 +76,10 @@ Future<void> main(List<String> rawArgs) async {
|
|||||||
|
|
||||||
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
||||||
|
|
||||||
|
if (DesktopTools.platform.isWindows || DesktopTools.platform.isLinux) {
|
||||||
|
MediaKit.ensureInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
await DesktopTools.ensureInitialized(
|
await DesktopTools.ensureInitialized(
|
||||||
DesktopWindowOptions(
|
DesktopWindowOptions(
|
||||||
hideTitleBar: true,
|
hideTitleBar: true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:audioplayers/audioplayers.dart' as ap;
|
import 'package:media_kit/media_kit.dart' as mk;
|
||||||
import 'package:just_audio/just_audio.dart' as ja;
|
import 'package:just_audio/just_audio.dart' as ja;
|
||||||
import 'package:flutter_desktop_tools/flutter_desktop_tools.dart';
|
import 'package:flutter_desktop_tools/flutter_desktop_tools.dart';
|
||||||
|
|
||||||
@ -13,19 +13,6 @@ enum AudioPlaybackState {
|
|||||||
buffering,
|
buffering,
|
||||||
stopped;
|
stopped;
|
||||||
|
|
||||||
static AudioPlaybackState fromApPlayerState(ap.PlayerState state) {
|
|
||||||
switch (state) {
|
|
||||||
case ap.PlayerState.playing:
|
|
||||||
return AudioPlaybackState.playing;
|
|
||||||
case ap.PlayerState.paused:
|
|
||||||
return AudioPlaybackState.paused;
|
|
||||||
case ap.PlayerState.stopped:
|
|
||||||
return AudioPlaybackState.stopped;
|
|
||||||
case ap.PlayerState.completed:
|
|
||||||
return AudioPlaybackState.completed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static AudioPlaybackState fromJaPlayerState(ja.PlayerState state) {
|
static AudioPlaybackState fromJaPlayerState(ja.PlayerState state) {
|
||||||
if (state.playing) {
|
if (state.playing) {
|
||||||
return AudioPlaybackState.playing;
|
return AudioPlaybackState.playing;
|
||||||
@ -43,50 +30,24 @@ enum AudioPlaybackState {
|
|||||||
return AudioPlaybackState.buffering;
|
return AudioPlaybackState.buffering;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static PlayerState fromAapPlayerState(aap.PlayerState state) {
|
|
||||||
// switch (state) {
|
|
||||||
// case aap.PlayerState.play:
|
|
||||||
// return PlayerState.playing;
|
|
||||||
// case aap.PlayerState.pause:
|
|
||||||
// return PlayerState.paused;
|
|
||||||
// case aap.PlayerState.stop:
|
|
||||||
// return PlayerState.stopped;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
ap.PlayerState get asAudioPlayerPlayerState {
|
|
||||||
switch (this) {
|
|
||||||
case AudioPlaybackState.playing:
|
|
||||||
return ap.PlayerState.playing;
|
|
||||||
case AudioPlaybackState.paused:
|
|
||||||
return ap.PlayerState.paused;
|
|
||||||
case AudioPlaybackState.stopped:
|
|
||||||
return ap.PlayerState.stopped;
|
|
||||||
case AudioPlaybackState.completed:
|
|
||||||
return ap.PlayerState.completed;
|
|
||||||
case AudioPlaybackState.buffering:
|
|
||||||
return ap.PlayerState.paused;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpotubeAudioPlayer {
|
class SpotubeAudioPlayer {
|
||||||
final ap.AudioPlayer? _audioPlayer;
|
final MkPlayerWithState? _mkPlayer;
|
||||||
final ja.AudioPlayer? _justAudio;
|
final ja.AudioPlayer? _justAudio;
|
||||||
|
|
||||||
SpotubeAudioPlayer()
|
SpotubeAudioPlayer()
|
||||||
: _audioPlayer = apSupportedPlatform ? ap.AudioPlayer() : null,
|
: _mkPlayer = mkSupportedPlatform ? MkPlayerWithState() : null,
|
||||||
_justAudio = !apSupportedPlatform ? ja.AudioPlayer() : null;
|
_justAudio = !mkSupportedPlatform ? ja.AudioPlayer() : null;
|
||||||
|
|
||||||
/// Whether the current platform supports the audioplayers plugin
|
/// Whether the current platform supports the audioplayers plugin
|
||||||
static final bool apSupportedPlatform =
|
static final bool mkSupportedPlatform =
|
||||||
DesktopTools.platform.isWindows || DesktopTools.platform.isLinux;
|
DesktopTools.platform.isWindows || DesktopTools.platform.isLinux;
|
||||||
|
|
||||||
// stream getters
|
// stream getters
|
||||||
Stream<Duration> get durationStream {
|
Stream<Duration> get durationStream {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.onDurationChanged.asBroadcastStream();
|
return _mkPlayer!.streams.duration.asBroadcastStream();
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.durationStream
|
return _justAudio!.durationStream
|
||||||
.where((event) => event != null)
|
.where((event) => event != null)
|
||||||
@ -96,25 +57,25 @@ class SpotubeAudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stream<Duration> get positionStream {
|
Stream<Duration> get positionStream {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.onPositionChanged.asBroadcastStream();
|
return _mkPlayer!.streams.position.asBroadcastStream();
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.positionStream.asBroadcastStream();
|
return _justAudio!.positionStream.asBroadcastStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<Duration> get bufferedPositionStream {
|
Stream<Duration> get bufferedPositionStream {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
// audioplayers doesn't have the capability to get buffered position
|
// audioplayers doesn't have the capability to get buffered position
|
||||||
return const Stream<Duration>.empty().asBroadcastStream();
|
return _mkPlayer!.streams.buffer.asBroadcastStream();
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.bufferedPositionStream.asBroadcastStream();
|
return _justAudio!.bufferedPositionStream.asBroadcastStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<void> get completedStream {
|
Stream<void> get completedStream {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.onPlayerComplete.asBroadcastStream();
|
return _mkPlayer!.streams.completed.asBroadcastStream();
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.playerStateStream
|
return _justAudio!.playerStateStream
|
||||||
.where(
|
.where(
|
||||||
@ -124,17 +85,15 @@ class SpotubeAudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stream<bool> get playingStream {
|
Stream<bool> get playingStream {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.onPlayerStateChanged.map((state) {
|
return _mkPlayer!.streams.playing.asBroadcastStream();
|
||||||
return state == ap.PlayerState.playing;
|
|
||||||
}).asBroadcastStream();
|
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.playingStream;
|
return _justAudio!.playingStream.asBroadcastStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<bool> get bufferingStream {
|
Stream<bool> get bufferingStream {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return Stream.value(false).asBroadcastStream();
|
return Stream.value(false).asBroadcastStream();
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.playerStateStream
|
return _justAudio!.playerStateStream
|
||||||
@ -148,10 +107,8 @@ class SpotubeAudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stream<AudioPlaybackState> get playerStateStream {
|
Stream<AudioPlaybackState> get playerStateStream {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.onPlayerStateChanged
|
return _mkPlayer!.playerStateStream.asBroadcastStream();
|
||||||
.map((state) => AudioPlaybackState.fromApPlayerState(state))
|
|
||||||
.asBroadcastStream();
|
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.playerStateStream
|
return _justAudio!.playerStateStream
|
||||||
.map(AudioPlaybackState.fromJaPlayerState)
|
.map(AudioPlaybackState.fromJaPlayerState)
|
||||||
@ -162,23 +119,23 @@ class SpotubeAudioPlayer {
|
|||||||
// regular info getter
|
// regular info getter
|
||||||
|
|
||||||
Future<Duration?> get duration async {
|
Future<Duration?> get duration async {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return await _audioPlayer!.getDuration();
|
return _mkPlayer!.state.duration;
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.duration;
|
return _justAudio!.duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Duration?> get position async {
|
Future<Duration?> get position async {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return await _audioPlayer!.getCurrentPosition();
|
return _mkPlayer!.state.position;
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.position;
|
return _justAudio!.position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Duration?> get bufferedPosition async {
|
Future<Duration?> get bufferedPosition async {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
// audioplayers doesn't have the capability to get buffered position
|
// audioplayers doesn't have the capability to get buffered position
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -187,8 +144,8 @@ class SpotubeAudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool get hasSource {
|
bool get hasSource {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.source != null;
|
return _mkPlayer!.state.playlist.medias.isNotEmpty;
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.audioSource != null;
|
return _justAudio!.audioSource != null;
|
||||||
}
|
}
|
||||||
@ -196,39 +153,39 @@ class SpotubeAudioPlayer {
|
|||||||
|
|
||||||
// states
|
// states
|
||||||
bool get isPlaying {
|
bool get isPlaying {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.state == ap.PlayerState.playing;
|
return _mkPlayer!.state.playing;
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.playing;
|
return _justAudio!.playing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get isPaused {
|
bool get isPaused {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.state == ap.PlayerState.paused;
|
return !_mkPlayer!.state.playing;
|
||||||
} else {
|
} else {
|
||||||
return !isPlaying;
|
return !isPlaying;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get isStopped {
|
bool get isStopped {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.state == ap.PlayerState.stopped;
|
return !hasSource;
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.processingState == ja.ProcessingState.idle;
|
return _justAudio!.processingState == ja.ProcessingState.idle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> get isCompleted async {
|
Future<bool> get isCompleted async {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
return _audioPlayer!.state == ap.PlayerState.completed;
|
return _mkPlayer!.state.completed;
|
||||||
} else {
|
} else {
|
||||||
return _justAudio!.processingState == ja.ProcessingState.completed;
|
return _justAudio!.processingState == ja.ProcessingState.completed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get isBuffering {
|
bool get isBuffering {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
// audioplayers doesn't have the capability to get buffering state
|
// audioplayers doesn't have the capability to get buffering state
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -238,12 +195,8 @@ class SpotubeAudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object _resolveUrlType(String url) {
|
Object _resolveUrlType(String url) {
|
||||||
if (apSupportedPlatform) {
|
if (mkSupportedPlatform) {
|
||||||
if (url.startsWith("https")) {
|
return mk.Media(url);
|
||||||
return ap.UrlSource(url);
|
|
||||||
} else {
|
|
||||||
return ap.DeviceFileSource(url);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (url.startsWith("https")) {
|
if (url.startsWith("https")) {
|
||||||
return ja.AudioSource.uri(Uri.parse(url));
|
return ja.AudioSource.uri(Uri.parse(url));
|
||||||
@ -254,19 +207,20 @@ class SpotubeAudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> preload(String url) async {
|
Future<void> preload(String url) async {
|
||||||
final urlType = _resolveUrlType(url);
|
throw UnimplementedError();
|
||||||
if (apSupportedPlatform && urlType is ap.Source) {
|
// final urlType = _resolveUrlType(url);
|
||||||
// audioplayers doesn't have the capability to preload
|
// if (mkSupportedPlatform && urlType is ap.Source) {
|
||||||
return;
|
// // audioplayers doesn't have the capability to preload
|
||||||
} else {
|
// return;
|
||||||
return;
|
// } else {
|
||||||
}
|
// return;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> play(String url) async {
|
Future<void> play(String url) async {
|
||||||
final urlType = _resolveUrlType(url);
|
final urlType = _resolveUrlType(url);
|
||||||
if (apSupportedPlatform && urlType is ap.Source) {
|
if (mkSupportedPlatform && urlType is mk.Media) {
|
||||||
await _audioPlayer?.play(urlType);
|
await _mkPlayer?.open(urlType, play: true);
|
||||||
} else {
|
} else {
|
||||||
if (_justAudio?.audioSource is ja.ProgressiveAudioSource &&
|
if (_justAudio?.audioSource is ja.ProgressiveAudioSource &&
|
||||||
(_justAudio?.audioSource as ja.ProgressiveAudioSource)
|
(_justAudio?.audioSource as ja.ProgressiveAudioSource)
|
||||||
@ -286,37 +240,78 @@ class SpotubeAudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> pause() async {
|
Future<void> pause() async {
|
||||||
await _audioPlayer?.pause();
|
await _mkPlayer?.pause();
|
||||||
await _justAudio?.pause();
|
await _justAudio?.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> resume() async {
|
Future<void> resume() async {
|
||||||
await _audioPlayer?.resume();
|
await _mkPlayer?.play();
|
||||||
await _justAudio?.play();
|
await _justAudio?.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> stop() async {
|
Future<void> stop() async {
|
||||||
await _audioPlayer?.stop();
|
await _mkPlayer?.pause();
|
||||||
await _justAudio?.stop();
|
await _justAudio?.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> seek(Duration position) async {
|
Future<void> seek(Duration position) async {
|
||||||
await _audioPlayer?.seek(position);
|
await _mkPlayer?.seek(position);
|
||||||
await _justAudio?.seek(position);
|
await _justAudio?.seek(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setVolume(double volume) async {
|
Future<void> setVolume(double volume) async {
|
||||||
await _audioPlayer?.setVolume(volume);
|
await _mkPlayer?.setVolume(volume);
|
||||||
await _justAudio?.setVolume(volume);
|
await _justAudio?.setVolume(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setSpeed(double speed) async {
|
Future<void> setSpeed(double speed) async {
|
||||||
await _audioPlayer?.setPlaybackRate(speed);
|
await _mkPlayer?.setRate(speed);
|
||||||
await _justAudio?.setSpeed(speed);
|
await _justAudio?.setSpeed(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
await _audioPlayer?.dispose();
|
await _mkPlayer?.dispose();
|
||||||
await _justAudio?.dispose();
|
await _justAudio?.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// MediaKit [mk.Player] by default doesn't have a state stream.
|
||||||
|
class MkPlayerWithState extends mk.Player {
|
||||||
|
final StreamController<AudioPlaybackState> _playerStateStream;
|
||||||
|
|
||||||
|
late final List<StreamSubscription> _subscriptions;
|
||||||
|
|
||||||
|
MkPlayerWithState({super.configuration})
|
||||||
|
: _playerStateStream = StreamController.broadcast() {
|
||||||
|
_subscriptions = [
|
||||||
|
streams.buffering.listen((event) {
|
||||||
|
_playerStateStream.add(AudioPlaybackState.buffering);
|
||||||
|
}),
|
||||||
|
streams.playing.listen((playing) {
|
||||||
|
if (playing) {
|
||||||
|
_playerStateStream.add(AudioPlaybackState.playing);
|
||||||
|
} else {
|
||||||
|
_playerStateStream.add(AudioPlaybackState.paused);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
streams.completed.listen((event) {
|
||||||
|
_playerStateStream.add(AudioPlaybackState.completed);
|
||||||
|
}),
|
||||||
|
streams.playlist.listen((event) {
|
||||||
|
if (event.medias.isEmpty) {
|
||||||
|
_playerStateStream.add(AudioPlaybackState.stopped);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
Stream<AudioPlaybackState> get playerStateStream => _playerStateStream.stream;
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<void> dispose({int code = 0}) {
|
||||||
|
for (var element in _subscriptions) {
|
||||||
|
element.cancel();
|
||||||
|
}
|
||||||
|
return super.dispose(code: code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <audioplayers_linux/audioplayers_linux_plugin.h>
|
|
||||||
#include <catcher/catcher_plugin.h>
|
#include <catcher/catcher_plugin.h>
|
||||||
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
||||||
#include <local_notifier/local_notifier_plugin.h>
|
#include <local_notifier/local_notifier_plugin.h>
|
||||||
|
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
|
||||||
#include <screen_retriever/screen_retriever_plugin.h>
|
#include <screen_retriever/screen_retriever_plugin.h>
|
||||||
#include <system_theme/system_theme_plugin.h>
|
#include <system_theme/system_theme_plugin.h>
|
||||||
#include <system_tray/system_tray_plugin.h>
|
#include <system_tray/system_tray_plugin.h>
|
||||||
@ -18,9 +18,6 @@
|
|||||||
#include <window_size/window_size_plugin.h>
|
#include <window_size/window_size_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar =
|
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin");
|
|
||||||
audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar);
|
|
||||||
g_autoptr(FlPluginRegistrar) catcher_registrar =
|
g_autoptr(FlPluginRegistrar) catcher_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "CatcherPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "CatcherPlugin");
|
||||||
catcher_plugin_register_with_registrar(catcher_registrar);
|
catcher_plugin_register_with_registrar(catcher_registrar);
|
||||||
@ -30,6 +27,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||||||
g_autoptr(FlPluginRegistrar) local_notifier_registrar =
|
g_autoptr(FlPluginRegistrar) local_notifier_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "LocalNotifierPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "LocalNotifierPlugin");
|
||||||
local_notifier_plugin_register_with_registrar(local_notifier_registrar);
|
local_notifier_plugin_register_with_registrar(local_notifier_registrar);
|
||||||
|
g_autoptr(FlPluginRegistrar) media_kit_libs_linux_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitLibsLinuxPlugin");
|
||||||
|
media_kit_libs_linux_plugin_register_with_registrar(media_kit_libs_linux_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
|
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
|
||||||
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
|
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
audioplayers_linux
|
|
||||||
catcher
|
catcher
|
||||||
flutter_secure_storage_linux
|
flutter_secure_storage_linux
|
||||||
local_notifier
|
local_notifier
|
||||||
|
media_kit_libs_linux
|
||||||
screen_retriever
|
screen_retriever
|
||||||
system_theme
|
system_theme
|
||||||
system_tray
|
system_tray
|
||||||
@ -16,6 +16,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
media_kit_native_event_loop
|
||||||
metadata_god
|
metadata_god
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import Foundation
|
|||||||
|
|
||||||
import audio_service
|
import audio_service
|
||||||
import audio_session
|
import audio_session
|
||||||
import audioplayers_darwin
|
|
||||||
import catcher
|
import catcher
|
||||||
import device_info_plus
|
import device_info_plus
|
||||||
import flutter_secure_storage_macos
|
import flutter_secure_storage_macos
|
||||||
@ -27,7 +26,6 @@ import window_size
|
|||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
AudioServicePlugin.register(with: registry.registrar(forPlugin: "AudioServicePlugin"))
|
AudioServicePlugin.register(with: registry.registrar(forPlugin: "AudioServicePlugin"))
|
||||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||||
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
|
|
||||||
CatcherPlugin.register(with: registry.registrar(forPlugin: "CatcherPlugin"))
|
CatcherPlugin.register(with: registry.registrar(forPlugin: "CatcherPlugin"))
|
||||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||||
|
104
pubspec.lock
104
pubspec.lock
@ -137,62 +137,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.13"
|
version: "0.1.13"
|
||||||
audioplayers:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: audioplayers
|
|
||||||
sha256: "6063c05f987596ba7a3dad9bb9a5d8adfa5e7c07b9bae5301b27c11d0b3a239f"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "4.0.1"
|
|
||||||
audioplayers_android:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: audioplayers_android
|
|
||||||
sha256: fb6bca878ad175d8f6ddc0e0a2d4226d81fa7c10747c12db420e96c7a096b2cc
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.0.1"
|
|
||||||
audioplayers_darwin:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: audioplayers_darwin
|
|
||||||
sha256: c4a56c49347b2e85ac4e1efea218948ca0fba87f04d2a3d3de07ce2410037038
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "4.0.1"
|
|
||||||
audioplayers_linux:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: audioplayers_linux
|
|
||||||
sha256: "897e24f190232a3fbb88134b062aa83a9240f55789b5e8d17c114283284ef56b"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.1"
|
|
||||||
audioplayers_platform_interface:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: audioplayers_platform_interface
|
|
||||||
sha256: "3a90a46198d375fc7d47bc1d3070c8fd8863b6469b7d87ca80f953efb090f976"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "5.0.0"
|
|
||||||
audioplayers_web:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: audioplayers_web
|
|
||||||
sha256: "4f5dcbfec0bf98ea09e243d5f5b64ea43a4e6710a2f292724bed16cdba3c691e"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.0.1"
|
|
||||||
audioplayers_windows:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: audioplayers_windows
|
|
||||||
sha256: "010f575653c01ccbe9756050b18df83d89426740e04b684f6438aa26c775a965"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.1"
|
|
||||||
auto_size_text:
|
auto_size_text:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -1086,6 +1030,38 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.2.0"
|
||||||
|
media_kit:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: media_kit
|
||||||
|
sha256: d9a32b3f6eafdfbba6aff2e37045a3a80009b6dfbdeec638d51d85e8b254a6a2
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.7+1"
|
||||||
|
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_windows_audio:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: media_kit_libs_windows_audio
|
||||||
|
sha256: f6ad5a1b910a6748a7350360756cd99a718fc9661a9583a7fd86a308d068dd81
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.3"
|
||||||
|
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"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1423,6 +1399,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.27.7"
|
version: "0.27.7"
|
||||||
|
safe_local_storage:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: safe_local_storage
|
||||||
|
sha256: ede4eb6cb7d88a116b3d3bf1df70790b9e2038bc37cb19112e381217c74d9440
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.2"
|
||||||
screen_retriever:
|
screen_retriever:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1765,6 +1749,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
|
uri_parser:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: uri_parser
|
||||||
|
sha256: "6543c9fd86d2862fac55d800a43e67c0dcd1a41677cb69c2f8edfe73bbcf1835"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
url_launcher:
|
url_launcher:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -13,7 +13,6 @@ dependencies:
|
|||||||
async: ^2.9.0
|
async: ^2.9.0
|
||||||
audio_service: ^0.18.9
|
audio_service: ^0.18.9
|
||||||
audio_session: ^0.1.13
|
audio_session: ^0.1.13
|
||||||
audioplayers: ^4.0.1
|
|
||||||
auto_size_text: ^3.0.0
|
auto_size_text: ^3.0.0
|
||||||
badges: ^2.0.3
|
badges: ^2.0.3
|
||||||
buttons_tabbar: ^1.3.6
|
buttons_tabbar: ^1.3.6
|
||||||
@ -58,6 +57,10 @@ dependencies:
|
|||||||
json_serializable: ^6.6.0
|
json_serializable: ^6.6.0
|
||||||
just_audio: ^0.9.32
|
just_audio: ^0.9.32
|
||||||
logger: ^1.1.0
|
logger: ^1.1.0
|
||||||
|
media_kit: ^0.0.7+1
|
||||||
|
media_kit_libs_linux: ^1.0.2
|
||||||
|
media_kit_libs_windows_audio: ^1.0.3
|
||||||
|
media_kit_native_event_loop: ^1.0.3
|
||||||
metadata_god: ^0.4.1
|
metadata_god: ^0.4.1
|
||||||
mime: ^1.0.2
|
mime: ^1.0.2
|
||||||
mpris_service:
|
mpris_service:
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <audioplayers_windows/audioplayers_windows_plugin.h>
|
|
||||||
#include <catcher/catcher_plugin.h>
|
#include <catcher/catcher_plugin.h>
|
||||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||||
#include <local_notifier/local_notifier_plugin.h>
|
#include <local_notifier/local_notifier_plugin.h>
|
||||||
|
#include <media_kit_libs_windows_audio/media_kit_libs_windows_audio_plugin_c_api.h>
|
||||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||||
#include <screen_retriever/screen_retriever_plugin.h>
|
#include <screen_retriever/screen_retriever_plugin.h>
|
||||||
#include <system_theme/system_theme_plugin.h>
|
#include <system_theme/system_theme_plugin.h>
|
||||||
@ -19,14 +19,14 @@
|
|||||||
#include <window_size/window_size_plugin.h>
|
#include <window_size/window_size_plugin.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
AudioplayersWindowsPluginRegisterWithRegistrar(
|
|
||||||
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
|
|
||||||
CatcherPluginRegisterWithRegistrar(
|
CatcherPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("CatcherPlugin"));
|
registry->GetRegistrarForPlugin("CatcherPlugin"));
|
||||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||||
LocalNotifierPluginRegisterWithRegistrar(
|
LocalNotifierPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("LocalNotifierPlugin"));
|
registry->GetRegistrarForPlugin("LocalNotifierPlugin"));
|
||||||
|
MediaKitLibsWindowsAudioPluginCApiRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("MediaKitLibsWindowsAudioPluginCApi"));
|
||||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||||
ScreenRetrieverPluginRegisterWithRegistrar(
|
ScreenRetrieverPluginRegisterWithRegistrar(
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
audioplayers_windows
|
|
||||||
catcher
|
catcher
|
||||||
flutter_secure_storage_windows
|
flutter_secure_storage_windows
|
||||||
local_notifier
|
local_notifier
|
||||||
|
media_kit_libs_windows_audio
|
||||||
permission_handler_windows
|
permission_handler_windows
|
||||||
screen_retriever
|
screen_retriever
|
||||||
system_theme
|
system_theme
|
||||||
@ -17,6 +17,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
media_kit_native_event_loop
|
||||||
metadata_god
|
metadata_god
|
||||||
smtc_windows
|
smtc_windows
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user