Open rafaelqcosta opened 2 years ago
Hello. I'm experiencing the same problem! On Android only.
Same problem here...
Any updates?
Hi! I didn't get any answer. I ended up changing the plugin. Depending on what you need, there are different options. Best regards!
@tuvia Thanks for replying so fast! I want the simplest solution to keep the media playing in the background, how did you solve this issue?
Check just_audio_background plugin. If you need video, you'll have to work a little bit more. I used fijkplayer with audio_service .I can share my code if you want.
Solved by requesting ignore battery optimization permission:
Permission.ignoreBatteryOptimizations.request();
And added to the manifest the permissions: android.permission.FOREGROUND_SERVICE, android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
History check ok.
Describe the bug After a few minutes of listening to the audio with the screen locked, the audio suddenly stops. When unlocking the screen and returning to the app the process is still running. Then it is necessary to pause the video and play again.
To Reproduce
*Example code
BetterPlayerConfiguration( aspectRatio: 16 / 9, autoPlay: false, startAt: Duration(seconds: widget.lesson?.currentTime?.toInt() ?? 0), deviceOrientationsAfterFullScreen: [ DeviceOrientation.portraitUp, ], handleLifecycle: false, autoDetectFullscreenDeviceOrientation: true, ), betterPlayerDataSource: BetterPlayerDataSource( BetterPlayerDataSourceType.network, widget.lesson?.videoInformation?.files?.last.link ?? '', notificationConfiguration: BetterPlayerNotificationConfiguration( showNotification: true, title: widget.lesson?.title, author: widget.lesson?.courseTrail?.title, imageUrl: IFileStorageRepository.imagePath(widget.lesson?.thumbnailFileUUID ?? ''), ), bufferingConfiguration: BetterPlayerConfig.buffer, cacheConfiguration: BetterPlayerConfig.cache, ), );
and
` class BetterPlayerConfig { static const buffer = BetterPlayerBufferingConfiguration( minBufferMs: 50000, maxBufferMs: 13107200, bufferForPlaybackMs: 2500, bufferForPlaybackAfterRebufferMs: 5000, );
static const cache = BetterPlayerCacheConfiguration( useCache: true, preCacheSize: 10 1024 1024, maxCacheSize: 10 1024 1024, maxCacheFileSize: 10 1024 1024,
); } `
Expected behavior adjust the error
Screenshots it's not necessary
Flutter doctor it's all ok
Better Player version
Smartphone (please complete the following information):