mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-15 19:48:23 +00:00
feat: background playback (wip)
https://github.com/ryanheise/audio_service/issues/1124
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import 'dart:developer' as developer;
|
||||
|
||||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
@ -7,6 +8,9 @@ import 'package:zap_stream_flutter/app.dart';
|
||||
import 'package:zap_stream_flutter/const.dart';
|
||||
import 'package:zap_stream_flutter/i18n/strings.g.dart';
|
||||
import 'package:zap_stream_flutter/notifications.dart';
|
||||
import 'package:zap_stream_flutter/player.dart';
|
||||
|
||||
late final MainPlayer mainPlayer;
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
@ -20,5 +24,14 @@ Future<void> main() async {
|
||||
developer.log("Failed to setup notifications: $e");
|
||||
});
|
||||
|
||||
mainPlayer = await AudioService.init(
|
||||
builder: () => MainPlayer(),
|
||||
config: AudioServiceConfig(
|
||||
androidNotificationChannelId: "io.nostrlabs.zap_stream_flutter.player",
|
||||
androidNotificationChannelName: "player",
|
||||
androidNotificationOngoing: true
|
||||
),
|
||||
);
|
||||
|
||||
runZapStream();
|
||||
}
|
||||
|
Reference in New Issue
Block a user