✨ Error notifier
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:media_kit/media_kit.dart' hide Track;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:rhythm_box/platform.dart';
|
||||
import 'package:rhythm_box/providers/audio_player.dart';
|
||||
import 'package:rhythm_box/providers/error_notifier.dart';
|
||||
import 'package:rhythm_box/services/local_track.dart';
|
||||
import 'package:rhythm_box/services/server/server.dart';
|
||||
import 'package:rhythm_box/widgets/tracks/querying_track_info.dart';
|
||||
@ -93,7 +94,7 @@ abstract class AudioPlayerInterface {
|
||||
),
|
||||
) {
|
||||
_mkPlayer.stream.error.listen((event) {
|
||||
log('[Playback] Error: $event');
|
||||
Get.find<ErrorNotifier>().logError('[Playback] Error: $event');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -90,16 +90,28 @@ class RhythmAudioPlayer extends AudioPlayerInterface
|
||||
|
||||
Future<void> skipToNext() async {
|
||||
Get.find<QueryingTrackInfoProvider>().isQueryingTrackInfo.value = true;
|
||||
Get.find<AudioPlayerProvider>().durationBuffered.value =
|
||||
const Duration(seconds: 0);
|
||||
Get.find<AudioPlayerProvider>().durationCurrent.value =
|
||||
const Duration(seconds: 0);
|
||||
await _mkPlayer.next();
|
||||
}
|
||||
|
||||
Future<void> skipToPrevious() async {
|
||||
Get.find<QueryingTrackInfoProvider>().isQueryingTrackInfo.value = true;
|
||||
Get.find<AudioPlayerProvider>().durationBuffered.value =
|
||||
const Duration(seconds: 0);
|
||||
Get.find<AudioPlayerProvider>().durationCurrent.value =
|
||||
const Duration(seconds: 0);
|
||||
await _mkPlayer.previous();
|
||||
}
|
||||
|
||||
Future<void> jumpTo(int index) async {
|
||||
Get.find<QueryingTrackInfoProvider>().isQueryingTrackInfo.value = true;
|
||||
Get.find<AudioPlayerProvider>().durationBuffered.value =
|
||||
const Duration(seconds: 0);
|
||||
Get.find<AudioPlayerProvider>().durationCurrent.value =
|
||||
const Duration(seconds: 0);
|
||||
await _mkPlayer.jump(index);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:flutter_broadcasts/flutter_broadcasts.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:audio_session/audio_session.dart';
|
||||
import 'package:rhythm_box/platform.dart';
|
||||
import 'package:rhythm_box/providers/error_notifier.dart';
|
||||
|
||||
// ignore: implementation_imports
|
||||
import 'package:rhythm_box/services/audio_player/playback_state.dart';
|
||||
@ -49,7 +50,7 @@ class CustomPlayer extends Player {
|
||||
}
|
||||
}),
|
||||
stream.error.listen((event) {
|
||||
log('[MediaKitError] $event');
|
||||
Get.find<ErrorNotifier>().logError('[Playback] Error: $event');
|
||||
}),
|
||||
];
|
||||
PackageInfo.fromPlatform().then((packageInfo) {
|
||||
|
Reference in New Issue
Block a user