Git Product home page Git Product logo

flutter.plugins's Introduction

Flutter plugins

Build Status

This repository contains the source code for Flutter plugins that are developed by Google but not by the core Flutter team. Check the packages directory for all plugins.

Flutter plugins enable access to platform-specific APIs. For more information about plugins, and how to use them, see https://flutter.io/platform-plugins/.

These plugins are also available on pub.

Issues

Please file any issues, bugs, or feature requests in the this repo.

Contributing

If you wish to contribute a new plugin, please see the documentation for developing packages and platform channels. Once your plugin is ready you can publish to the pub repository.

If you wish to contribute a change to any of the existing plugins in this repo, please review our contribution guide, and send a pull request.

flutter.plugins's People

Contributors

arodriguezgb avatar bhargavcp avatar diglesia-google avatar gilescm avatar hixie avatar ianko avatar jiajiabingcheng avatar lidongze91 avatar mehmetf avatar michaelrfairhurst avatar mit-mit avatar monkeyswarm avatar rguntha avatar tvolkert avatar wexder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter.plugins's Issues

Gapless support

Firstly - Thanks for a great easy to use plugin.

I have an issue (hoping its easy to fix) relating to using this plugin in Android.

In iOS this plugin works perfectly. You can run an asset based file and the plugin loops continuously without any break in the audio playback.

However - in Android, there is a noticeable break/short delay when the track is looped and so the effect of gapless playback is lost.

I've tested on Live devices and also Android simulators (Running Android 8,9 etc).

I've also tested with Flutter 1.7.8, 1.12.13 (Have not moved to 1.17.x because of the huge number of bugs and instability issues with Cloud Firestore)

The Small Icon is not loading for me sicne 1.3.3

@monkeyswarm
Like the title says, the small icon shows as a blank square now. Code is still the same as before.

<meta-data android:name="ic_audiofileplayer" android:value="drawable/ic_gb_small_logo" />

The icon is a transparent png, it used to work fine.

Screen Shot 2021-02-07 at 1 49 18 PM

Could it be something with the asset loading fix that we need to change something ?

getPhoneLogs on device (version < android M) crashes

Hi,
New to flutter, I wanted to access the call log and discovered that repo.

The problem I found was that getPhoneLogs access the permission API (available in android M) to check the permission. On a device with a version lower than that, it crashes. (log below)

I fixed it with a SDK check before calling a function with permission API, and one without permission API to be able to be called from older version.
I'll send some PR if that's ok.

E/flutter (11916): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(40)] java.lang.NoSuchMethodError: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar:classes2.dex)
E/flutter (11916): 	at com.jiajiabingcheng.phonelog.PhoneLogPlugin.fetchCallRecords(PhoneLogPlugin.java:146)
E/flutter (11916): 	at com.jiajiabingcheng.phonelog.PhoneLogPlugin.onMethodCall(PhoneLogPlugin.java:58)
E/flutter (11916): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
E/flutter (11916): 	at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188)
E/flutter (11916): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
E/flutter (11916): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (11916): 	at android.os.MessageQueue.next(MessageQueue.java:143)
E/flutter (11916): 	at android.os.Looper.loop(Looper.java:130)
E/flutter (11916): 	at android.app.ActivityThread.main(ActivityThread.java:5834)
E/flutter (11916): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (11916): 	at java.lang.reflect.Method.invoke(Method.java:372)
E/flutter (11916): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
E/flutter (11916): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
E/flutter (11916): 
F/flutter (11916): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env). 
F/libc    (11916): Fatal signal 6 (SIGABRT), code -6 in tid 11916 (.example.regord)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/kltexx/klte:5.0/LRX21T/G900FXXU1BNL9:user/release-keys'
Revision: '14'
ABI: 'arm'
pid: 11916, tid: 11916, name: .example.regord  >>> com.example.regord <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env). 
'
    r0 00000000  r1 00002e8c  r2 00000006  r3 00000000
    r4 b6f1e114  r5 00000006  r6 0000000b  r7 0000010c
    r8 bef48c94  r9 00000008  sl 00000001  fp aeda3388
    ip 00002e8c  sp bef48b78  lr b6ea7fd5  pc b6ecb978  cpsr 600d0010
backtrace:
    #00 pc 00037978  /system/lib/libc.so (tgkill+12)
    #01 pc 00013fd1  /system/lib/libc.so (pthread_kill+52)
    #02 pc 00014bef  /system/lib/libc.so (raise+10)
    #03 pc 00011531  /system/lib/libc.so (__libc_android_abort+36)
    #04 pc 0000fcbc  /system/lib/libc.so (abort+4)
    #05 pc 0002ebb7  /data/app/com.example.regord-1/lib/arm/libflutter.so
    #06 pc 000252e5  /data/app/com.example.regord-1/lib/arm/libflutter.so
    #07 pc 00024745  /data/app/com.example.regord-1/lib/arm/libflutter.so
    #08 pc 00055849  /data/app/com.example.regord-1/lib/arm/libflutter.so
    #09 pc 0002fd99  /data/app/com.example.regord-1/lib/arm/libflutter.so
    #10 pc 00031295  /data/app/com.example.regord-1/lib/arm/libflutter.so
    #11 pc 0001030f  /system/lib/libutils.so (android::SimpleLooperCallback::handleEvent(int, int, void*)+10)
    #12 pc 00010f6f  /system/lib/libutils.so (android::Looper::pollInner(int)+482)
    #13 pc 00011019  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
    #14 pc 00083079  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
    #15 pc 000b2397  /system/framework/arm/boot.oat

Future<List<Object>> function() {} doesn't show code suggestions for Flutter (Android Studio & Vscode)

I have already tested:

  • File/Invalidate cache
  • remove ~/.dartServer/.analysis-driver/

image

[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.19041.388], locale en-US)
• Flutter version 1.20.1 at C:\Users\babakoto\Downloads\flutter_windows_1.20.1-stable\flutter
• Framework revision 2ae34518b8 (4 days ago), 2020-08-05 19:53:19 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\babakoto\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 48.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.47.3)
• VS Code at C:\Users\babakoto\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.13.2

[√] Connected device (1 available)
• MAR LX1A (mobile) • L2N0220319011997 • android-arm64 • Android 10 (API 29)

! Doctor found issues in 1 category.
Process finished with exit code 0

AudioPluginError

I have an error when playing this remote MP3 file on Android 10:

E/flutter (17470): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(AudioPluginError, Remote URL loading failed for URL: https://streaming-canal-u.fmsh.fr/vod/media/canalu/videos/ehess/gammes.rythmes.et.maths_47461/master.5.math.chemilier.mp3, null, null)
E/flutter (17470): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7)
E/flutter (17470): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
E/flutter (17470):
E/flutter (17470): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
E/flutter (17470): #3 Audio._sendMethodCall (package:audiofileplayer/audiofileplayer.dart:751:32)
E/flutter (17470): #4 Audio._load (package:audiofileplayer/audiofileplayer.dart:433:13)
E/flutter (17470): #5 Audio.loadFromRemoteUrl (package:audiofileplayer/audiofileplayer.dart:410:9)

It works in other players (VLC...).

Main screen or secondary screen for background play

Hi,

Can the audio player be initialized from secondary screen such as main->screen2 or does it have to be done on the first screen. Reason is I am having issues with background play and receiving errors like the below when pressing home button from secondary screen and im guessing this may be the issue. This however doesnt happen on the example app where it continues to play. Any help would be appreciated. Thanks!

Error:
E/AndroidRuntime(24856): java.lang.NoSuchMethodError: No static method putVersionedParcelable(Landroid/os/Bundle;Ljava/lang/String;Landroidx/versionedparcelable/VersionedParcelable;)V in class Landroidx/versionedparcelable/ParcelUtils; or its super classes (declaration of 'androidx.versionedparcelable.ParcelUtils' appears in /data/app/com.example.danda-Ti-9fcbCHWVzNlyasfot4w==/base.apk) E/AndroidRuntime(24856): at android.support.v4.media.session.MediaSessionCompat$Callback$MediaSessionCallbackApi21.onCommand(MediaSessionCompat.java:1472) E/AndroidRuntime(24856): at android.media.session.MediaSession$CallbackMessageHandler.handleMessage(MediaSession.java:1575) E/AndroidRuntime(24856): at android.os.Handler.dispatchMessage(Handler.java:107) E/AndroidRuntime(24856): at android.os.Looper.loop(Looper.java:214) E/AndroidRuntime(24856): at android.app.ActivityThread.main(ActivityThread.java:7356) E/AndroidRuntime(24856): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(24856): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/AndroidRuntime(24856): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) I/Process (24856): Sending signal. PID: 24856 SIG: 9

Logcat:
Process: com.example.danda, PID: 24856 java.lang.NoSuchMethodError: No static method putVersionedParcelable(Landroid/os/Bundle;Ljava/lang/String;Landroidx/versionedparcelable/VersionedParcelable;)V in class Landroidx/versionedparcelable/ParcelUtils; or its super classes (declaration of 'androidx.versionedparcelable.ParcelUtils' appears in /data/app/com.example.danda-Ti-9fcbCHWVzNlyasfot4w==/base.apk) at android.support.v4.media.session.MediaSessionCompat$Callback$MediaSessionCallbackApi21.onCommand(MediaSessionCompat.java:1472) at android.media.session.MediaSession$CallbackMessageHandler.handleMessage(MediaSession.java:1575) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

2020-04-17 12:59:50.388 24979-24979/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.danda, PID: 24979 java.lang.RuntimeException: Unable to start service com.google.flutter.plugins.audiofileplayer.AudiofileplayerService@f2f9ae9 with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4105) at android.app.ActivityThread.access$1800(ActivityThread.java:219) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference at com.google.flutter.plugins.audiofileplayer.AudiofileplayerService.onStartCommand(AudiofileplayerService.java:96) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4087) at android.app.ActivityThread.access$1800(ActivityThread.java:219)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)  at android.os.Handler.dispatchMessage(Handler.java:107)  at android.os.Looper.loop(Looper.java:214)  at android.app.ActivityThread.main(ActivityThread.java:7356)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 

PlatformException: Called pause on an unloaded player

I see the following exception in the logs. It's from a user - I don't know if it was noticeable or happened quietly in the background. In either case, it would be nice to avoid these exceptions. If plugin knows that a player is unloaded, it should not make a native call to pause it. If plugin does not know that, it should catch the exception so it does not bubble up to the app.

PlatformException(AudioPluginError, Called pause on an unloaded player: a42a0b90-8251-444d-a26e-90842bb7ddd1, null)

message_codecs.dart in StandardMethodCodec.decodeEnvelope at line 572
platform_channel.dart in MethodChannel._invokeMethod at line 161
Called from:
audiofileplayer.dart in Audio._sendMethodCall at line 751
Called from:
audiofileplayer.dart in Audio._pauseNative at line 676
Called from:
audiofileplayer.dart in Audio.pause at line 574
Called from:
player_controller_audiofileplayer.dart in PlayerControllerAudioFilePlayer.stop at line 395

PlatformException Called play on an unloaded player

I am experiencing this issue in the IOS platform. Tested on IOS 12-14 and the issue is very random. I am loading multiple players at once and some of them immediately raise the following exception after I try to play it.

Unhandled Exception: PlatformException(AudioPluginError, Called play on an unloaded player: ab8c017a-e614-476a-9704-a3df5a65b3dc, null, null)

#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)

#2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
#3 Audio._sendMethodCall (package:audiofileplayer/audiofileplayer.dart:751:32)
#4 Audio._playNative (package:audiofileplayer/audiofileplayer.dart:661:13)
#5 Audio._playHelper (package:audiofileplayer/audiofileplayer.dart:556:11)
#6 Audio.resume (package:audiofileplayer/audiofileplayer.dart:533:11)

[audiofileplayer] NullPointerException

First of all, very nice control with clean source code and GREAT comments! Thanks!

There is a corner case that throws an NPE. Steps to recreate:

  1. Try to load a remote file that is corrupted so that load fails.
  2. Handle the onError callback and dispose the audio control inside the callback.
  3. Without doing anything else, let the phone go to sleep.
  4. The following exception occurs:

I/AudiofileplayerPlugin(26650): onMethodCall: method = load
V/MediaHTTPService(26650): MediaHTTPService(android.media.MediaHTTPService@3cb2af9): Cookies: null
I/AudiofileplayerPlugin(26650): onMethodCall: method = setVolume
V/MediaHTTPService(26650): makeHTTPConnection: CookieManager created: java.net.CookieManager@a2f5a3e
V/MediaHTTPService(26650): makeHTTPConnection(android.media.MediaHTTPService@3cb2af9): cookieHandler: java.net.CookieManager@a2f5a3e Cookies: null
I/AudiofileplayerPlugin(26650): onMethodCall: method = play
E/MediaPlayerNative(26650): error (1, -2147483648)
E/MediaPlayer(26650): Error (1,-2147483648)
E/ManagedMediaPlayer(26650): onError: what:1 extra: -2147483648
I/flutter (26650): OnError called
I/flutter (26650): audio dispose called without awaiting

=== Everything looks good until the phone goes to sleep, then... ===

I/AudiofileplayerPlugin(26650): onMethodCall: method = pause
E/MethodChannel#audiofileplayer(26650): Failed to handle method call
E/MethodChannel#audiofileplayer(26650): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.flutter.plugins.audiofileplayer.ManagedMediaPlayer.pause()' on a null object reference
E/MethodChannel#audiofileplayer(26650): at com.google.flutter.plugins.audiofileplayer.AudiofileplayerPlugin.onMethodCall(AudiofileplayerPlugin.java:107)
E/MethodChannel#audiofileplayer(26650): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#audiofileplayer(26650): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#audiofileplayer(26650): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/MethodChannel#audiofileplayer(26650): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#audiofileplayer(26650): at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#audiofileplayer(26650): at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#audiofileplayer(26650): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#audiofileplayer(26650): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#audiofileplayer(26650): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#audiofileplayer(26650): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/DartMessenger(26650): Uncaught exception in binary message listener
E/DartMessenger(26650): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(26650): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:151)
E/DartMessenger(26650): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:240)
E/DartMessenger(26650): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/DartMessenger(26650): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/DartMessenger(26650): at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(26650): at android.os.MessageQueue.next(MessageQueue.java:336)
E/DartMessenger(26650): at android.os.Looper.loop(Looper.java:174)
E/DartMessenger(26650): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/DartMessenger(26650): at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(26650): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/DartMessenger(26650): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Phone call

I added the function that when you receive a phone call the app’s audio pauses, and when the call ends, it resume. When the app is not in the background there are no problems in both iOS and Android. When the app is in the background when the call comes, is there some problem. With Android this also works when the app is in the background (before the phone call arrives), but with iOS I can't automatically restart it. Even using didChangeAppLifecycleState with iOS when it is paused it is not possible to restart the audio (to my knowledge).
In Android, however, when it is in the background (always before the phone call arrives) it restarts, but I can't pause it so that when the phone call ends it restarts from the exact point where it stopped.
I thought that through “audio_system", you can control the audio in the background. I ask you if there is the possibility to control the audio even in the background so that it can restart it with iOS or pause it with Android. I hope I was clear.

[feature request] Play speed setting and cache

Thanks for this stable audio plugin and great work. It helped a lot when a newbie like me using flutter to develop audio app.
I would be really happy if two features added in the future.
1 Set play speed
2 Load remote file from cache when play the second time.
Don't know if you have any plan ?
Thanks for your time.

Crash not allowed to start service

Hello,
I'm getting this error :

Shutting down VM
I/flutter (15726): -----------------------------------------------------------
E/AndroidRuntime(15726): FATAL EXCEPTION: main
E/AndroidRuntime(15726): Process: com.my.app, PID: 15726
E/AndroidRuntime(15726): java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.my.app/com.google.flutter.plugins.audiofileplayer.AudiofileplayerService }: app is in background uid UidRecord{aaa2722 u0a737 LAST bg:+4m9s812ms idle change:cached procs:1 seq(0,0,0)}
E/AndroidRuntime(15726): 	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1650)
E/AndroidRuntime(15726): 	at android.app.ContextImpl.startService(ContextImpl.java:1605)
E/AndroidRuntime(15726): 	at android.content.ContextWrapper.startService(ContextWrapper.java:669)
E/AndroidRuntime(15726): 	at com.google.flutter.plugins.audiofileplayer.AudiofileplayerService$MediaSessionCallback.onPlay(AudiofileplayerService.java:316)
E/AndroidRuntime(15726): 	at android.support.v4.media.session.MediaSessionCompat$Callback$StubApi21.onPlay(MediaSessionCompat.java:1405)
E/AndroidRuntime(15726): 	at android.support.v4.media.session.MediaSessionCompatApi21$CallbackProxy.onPlay(MediaSessionCompatApi21.java:196)
E/AndroidRuntime(15726): 	at android.media.session.MediaSession$CallbackMessageHandler.handleMessage(MediaSession.java:1593)
E/AndroidRuntime(15726): 	at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(15726): 	at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(15726): 	at android.app.ActivityThread.main(ActivityThread.java:7682)
E/AndroidRuntime(15726): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15726): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
E/AndroidRuntime(15726): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

I run the service in background on my Oneplus 6 Android 10,

I'm not sure, but shouldn't we use :

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        startForegroundService(new Intent(AudiofileplayerService.this, AudiofileplayerService.class));
} else {
        startService(new Intent(AudiofileplayerService.this, AudiofileplayerService.class));
}

inside the onPlay() method from MediaSessionCallback ?
thanks

Exiting the app causes audio to stop

On Android, when you press back buttons multiple times to exit the app, the current playing audio stops with the following log message-

W/FlutterJNI(21594): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: audiofileplayer. Response ID: 0

The notification controls do not work either. Only the seek bar on the notification is updated at each passing second.

Flutter doctor output-
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.17.0, on Mac OS X 10.14.5 18F132, locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.
[!] Xcode - develop for iOS and macOS (Xcode 11.3.1)
! CocoaPods 1.7.3 out of date (1.8.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade:
sudo gem install cocoapods
[✓] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2017.2.5)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.44.0)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)

Problem with audio in Android. It stops after 6:20 minutes

I found a problem. In my app, I load a lot of small audio files in sequence, one after another. With iOS there are no problems, and I can continue indefinitely, with Android I have the problem that is when he's in the backgrounds, even when it s not background, that the audio stopping at 6 minutes and 20 seconds. At this point, the audio cannot be restored and I have to close and reopen the app. I don't think it s a code problem because in iOS I don't have any problems. Maybe it's a memory management problem. As I said before, it happens in the same spot with background music and not.

[audiofileplayer] Provide more detailed error data

Hey,

I find this plugin underrated as it is one of the rare ones that provides true background audio as well as local and remote files playing. So congrats to the developers and thank you for the great job, it is precious!

One problem I encounter is that when the player doesn't manage to play a remote string, the error message is still the same and isn't much helpful to understand what is wrong.

It would be great if it were possible to provide in some way the error reported by the host system.

Thanks,
mmmm

Crash : android.app.ActivityThread$H.handleMessage (ActivityThread.java:2188)

Hey guys, I installed crashalytics and was able to find more about this crash. Its about the notification, more closely the .setShowActionsInCompactView().

Screen Shot 2021-01-30 at 3 15 27 PM

This line here:
Screen Shot 2021-01-30 at 3 16 23 PM

I found more info about it here
https://stackoverflow.com/questions/47920158/java-lang-illegalargumentexception-setshowactionsincompactview-action-1-out-of
and here
tanguyantoine/react-native-music-control#230

Here is a bit of an explanation of what could be happening.
Screen Shot 2021-01-30 at 3 20 45 PM

I am not very knowledgable on Java, so Im not perfectly sure how to help but maybe others can help so we can eliminate this crash from this helpful plugin.

Edit:
Changing this .setShowActionsInCompactView(compactNotificationActionIndices) to
this .setShowActionsInCompactView(0) crashes the app on startup with the exact crash that Ive seen reported on the developer console.

So im thinking there is something with with the logic of the compactIndices that in certain scenarios it makes the app crash.

Looping audio doesn't work

 _audio2 = Audio.loadFromRemoteUrl(url,
        playInBackground: true,
        looping: true, // <<<<<<<<<<< here!
        onPosition: _backgroundOnPosition,
        onComplete: _backgroundOnComplete,
        onError: (error) => onError(error))
      ..play();

//....

  void _backgroundOnComplete() {
    print('complete!');
  }

  void _backgroundOnPosition(double position) {
    print(position);
  }

  void onError(var error) {
    print(error.toString());
  }

Setting looping to true doesn't make the audio loop.

The above code prints this output:

flutter: 0.0
flutter: 0.250060887
flutter: 0.500675319
flutter: 0.751075692
flutter: 1.001015662
flutter: 1.250292806
flutter: 1.500241974
........
flutter: 9.7511342
flutter: 10.000516212
flutter: 10.250713764
flutter: complete!

Crash on play after update to Android 11

I'm getting this crash when playing audio after updating to Android 11:

java.lang.RuntimeException: Unable to create service com.ryanheise.audioservice.AudioService: java.lang.ClassNotFoundException: Didn't find class "com.ryanheise.audioservice.AudioService" on path: DexPathList[[zip file "/data/app/~~qwTN_ctB0CR8D8eF_XQa1Q==/com.example.stutter-hud8-N6w2IXX06yIeFsqMw==/base.apk"],nativeLibraryDirectories=[/data/app/~~qwTN_ctB0CR8D8eF_XQa1Q==/com.example.stutter-hud8-N6w2IXX06yIeFsqMw==/lib/x86, /data/app/~~qwTN_ctB0CR8D8eF_XQa1Q==/com.example.stutter-hud8-N6w2IXX06yIeFsqMw==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
E/AndroidRuntime( 7781): 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4204)
E/AndroidRuntime( 7781): 	at android.app.ActivityThread.access$1500(ActivityThread.java:237)
E/AndroidRuntime( 7781): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
E/AndroidRuntime( 7781): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 7781): 	at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime( 7781): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime( 7781): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7781): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime( 7781): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime( 7781): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ryanheise.audioservice.AudioService" on path: DexPathList[[zip file "/data/app/~~qwTN_ctB0CR8D8eF_XQa1Q==/com.example.stutter-hud8-N6w2IXX06yIeFsqMw==/base.apk"],nativeLibraryDirectories=[/data/app/~~qwTN_ctB0CR8D8eF_XQa1Q==/com.example.stutter-hud8-N6w2IXX06yIeFsqMw==/lib/x86, /data/app/~~qwTN_ctB0CR8D8eF_XQa1Q==/com.example.stutter-hud8-N6w2IXX06yIeFsqMw==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
E/AndroidRuntime( 7781): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
E/AndroidRuntime( 7781): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime( 7781): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime( 7781): 	at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:129)
E/AndroidRuntime( 7781): 	at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:66)
E/AndroidRuntime( 7781): 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4183)
E/AndroidRuntime( 7781): 	... 8 more

audiofileplayer status?

Hi,

I get a warning telling that the plugin uses deprecated APIs when building for Android, there are very few releases, and I see that many issues stay without answer several month after being created.

At the moment there is no Flutter official solution to play audio streaming in the background and this plugin is one of the few that does it, but it has some problems and it doesn't seem they will get a solution.

Could someone from the Google team provide information about the status of this project?

Thank you

Notification Player not properly loading after pressing stop button.

The notification player works fine until the user presses the stop button. The problem arises when the user presses play again and this time the notification player doesn't come back on. However, if the user uses the pause function in the player itself, the notification player comes back. The correct way it should work is that once the stop button is pressed and the player presses play again, the notification player should reappear as opposed to when calling the pause function.

Notification custom button not work

I wanted to use my own style icon on notification bar in my app, so I created some custom button , but only forwardButton worked, the other button showed on notification bar, but not worked at all, maybe only support one custom on notification bar at the same time?

if (mediaEvent.customEventId == replay10ButtonId) {
_forwardBackgroundAudio(-10.0);
} else if (mediaEvent.customEventId == playnowButtonId) {
_resumeBackgroundAudio();
} else if (mediaEvent.customEventId == forwardButtonId) {
_forwardBackgroundAudio(30.0);
} else if (mediaEvent.customEventId == pausenowButtonId) {
_pauseBackgroundAudio();
}

final _pauseButton = AndroidCustomMediaButton(
'pausenow', pausenowButtonId, 'ic_stat_pause_circle_filled');
final _replay10Button = AndroidCustomMediaButton(
'replay10', replay10ButtonId, 'ic_stat_replay_10');
final _forwardButton = AndroidCustomMediaButton(
'forward', forwardButtonId, 'ic_stat_forward_30');
final _playnowButton = AndroidCustomMediaButton(
'playnow', likeButtonId, 'ic_stat_play_circle_filled');

getPhoneLogs use wrong type of call log

Hi,
Today I tried to run the example code in a standard flutter emulator, and it failed with this log:

E/flutter (17759): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'Iterable<Map<String, Object>>'
E/flutter (17759): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:302:13)
E/flutter (17759): <asynchronous suspension>
E/flutter (17759): #1      PhoneLog.getPhoneLogs (package:phone_log/phone_log.dart:49:66)
E/flutter (17759): <asynchronous suspension>
E/flutter (17759): #2      _MyHomePageState.fetchCallLog (package:regord/main.dart:85:53)
E/flutter (17759): <asynchronous suspension>
E/flutter (17759): #3      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:513:14)
E/flutter (17759): #4      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:568:30)
E/flutter (17759): #5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:120:24)
E/flutter (17759): #6      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter (17759): #7      TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:204:7)
E/flutter (17759): #8      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (17759): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:20)
E/flutter (17759): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:192:22)
E/flutter (17759): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:149:7)
E/flutter (17759): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (17759): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
E/flutter (17759): #14     _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (17759): #15     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (17759): #16     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (17759): #17     _invoke1 (dart:ui/hooks.dart:223:10)
E/flutter (17759): #18     _dispatchPointerDataPacket (dart:ui/hooks.dart:144:5)

After a lot of investigation, it seems the invokeMethod doesn't really return what it should in its guts.

Problem with Android battery usage

I tried to install the example file on my Huawei but after a while I left it in backgrounds, it appeared to have a message from alert that this app kept updating backgrounds and was eating the battery

AudiofileplayerPlugin breaks automatic plugin registration

Hi,

I have an issue with audiofileplayer plugin registration, when this plugin is invoked automatically by the isolate, it always crashes and makes other plugins can't be loaded as well.

I've traced the exception and here's where the crash came from:

128 | private AudiofileplayerPlugin(Registrar registrar, MethodChannel methodChannel) {
129 |     this.registrar = registrar;
130 |     this.methodChannel = methodChannel;
131 |     this.mediaPlayers = new HashMap<>();
132 |     LifecycleCallbacks callbacks = new LifecycleCallbacks(this, registrar.activity().hashCode());
133 |     registrar.activity().getApplication().registerActivityLifecycleCallbacks(callbacks);

In line 132, it returned null when calling registrar.activity() and it crashed with NullPointerException when accessing hashCode(), is there no null check there? Because in ShimRegistrar, that method may return null when activityPluginBinding is a null too.

And this is my environment:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.720], locale en-ID)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] IntelliJ IDEA Community Edition (version 2019.3)
[√] VS Code (version 1.44.0)
[√] Connected device (1 available)

• No issues found!

I use latest plugin version 1.2.0, any workaround or a fix for this? Thanks.

Android Vitals ANR's increasing due to Context.startForeGroundService()

Helo guys, I was checking the vitals today of my app and it seems that its reporting a lot of the same issues with this.

Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{2c975c8 u0 APPNAMEHERE/com.google.flutter.plugins.audiofileplayer.AudiofileplayerService}

63 Total, 41 times on Android 10 and 21 times on Android 9.

Im not sure if its anything I could do on my end to fix or it requieres a fix on the plugin directly.

Any more info that you want, dont hesitate.

Notification issues

I am trying to create Audio Player Widget that is capable of playing playlist. Most of the functionality is working as expected. but having problems with notifications.

  1. When I am trying to seek (track bar) in the app, notification seekbar becomes out of sync.
  2. When I change track, notification seekbar still shows the first songs duration. Duration of new song is not getting updated.
  3. When I change track, notification comes correctly with new title name and sub title. but it just disappears.

Here is the link to the source code. Thanks for the amazing plugin.

https://github.com/wisecoders/audio_player

Required Android API is somewhat recent

The Android implementation uses
MediaPlayer.setDataSource(AssetFileDescriptor)
which is new as of API 24 (Nougat). Many devices have older OSes; see if there is a way to use something older.

Problem with Audio.loadFromRemoteUrl in Android

I'm doing podcast app. I am very happy with this plug-in. But I encountered a strange problem with the Audio.loadFromRemoteUrl function in Android. While with iOS it works perfectly, when I try to download the .mp3 audio file, from Android, I have an error that I report below. I don't understand what it can depend on. I added in the Manifest
"uses-permission android: name = "android.permission.INTERNET"
but this is not the problem because just before I always download the xml file from the server that provides me with the list of audio files. It seems like a media problem. If anyone can help me I would be very grateful.
Thanks in advance

========================================================================

D/MediaPlayerNative(16584): Message: MEDIA_ERROR(100), ext1=MEDIA_ERROR_UNKNOWN(1), ext2=0x80000000
E/MediaPlayerNative(16584): error (1, -2147483648)
E/MediaPlayer(16584): Error (1,-2147483648)
E/ManagedMediaPlayer(16584): onError: what:1 extra: -2147483648
V/PlayerBase(16584): baseStop() piid=199
I/MediaPlayer(16584): [HSM] stayAwake false uid: 10093, pid: 16584
E/flutter (16584): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(AudioPluginError, Remote URL loading failed for URL: http://www.uprubiera.org/spiritualpod/anno2020/20200715mexvor.mp3, null)
E/flutter (16584): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (16584): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (16584):
E/flutter (16584): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
E/flutter (16584): #3 Audio._sendMethodCall (package:audiofileplayer/audiofileplayer.dart:751:32)
E/flutter (16584): #4 Audio._load (package:audiofileplayer/audiofileplayer.dart:433:13)
E/flutter (16584): #5 Audio.loadFromRemoteUrl (package:audiofileplayer/audiofileplayer.dart:410:9)
E/flutter (16584): #6 _ListTracksState.playAudio (package:podcast_exemple/list_tracks.dart:58:20)
E/flutter (16584): #7 _ListTracksState.build... (package:podcast_exemple/list_tracks.dart:548:27)
E/flutter (16584): #8 State.setState (package:flutter/src/widgets/framework.dart:1233:30)
E/flutter (16584): #9 _ListTracksState.build.. (package:podcast_exemple/list_tracks.dart:545:25)
E/flutter (16584): #10 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
E/flutter (16584): #11 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:862:36)
E/flutter (16584): #12 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (16584): #13 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:504:11)
E/flutter (16584): #14 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:282:5)
E/flutter (16584): #15 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:254:7)
E/flutter (16584): #16 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (16584): #17 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
E/flutter (16584): #18 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (16584): #19 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (16584): #20 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (16584): #21 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (16584): #22 _rootRunUnary (dart:async/zone.dart:1196:13)
E/flutter (16584): #23 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (16584): #24 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter (16584): #25 _invoke1 (dart:ui/hooks.dart:275:10)
E/flutter (16584): #26 _dispatchPointerDataPacket (dart:ui/hooks.dart:184:5)

Dart Reply onERROR crach

This crash is happening on the 1.3.3 , it was happening before. I forgot I fixed it, its just a try and catch on the onError method on RemoteManagedMediaPlayer. However I dont know where do you want to save, or sotore or display the exception so I will just add it blank with my PR.

Screen Shot 2021-02-10 at 10 50 14 AM

Error while invoking MediaControllerCompat$TransportControls

First off, thanks for creating an awesome plugin which combines a lot of the pain points of other audio plugins and fixes them in one simple one.

I have migrated my project today to use this plugin but ran into an issue where I try to load a remote file stream but I get the following error message

I/flutter (32071): Attempt to invoke virtual method 'android.support.v4.media.session.MediaControllerCompat$TransportControls android.support.v4.media.session.MediaControllerCompat.getTransportControls()' on a null object reference

This error came from inside the onError() function which comes with Audio.loadFromRemoteURL() function.

I am not really sure what the issue could be. I made sure to add the service and receiver within AndroidManifest.xml file however nothing seems to fix it.

My project is open source and you can view where I am using the plugin here: https://github.com/Andrewngabriel/radio-player/blob/v0.1/lib/widgets/player.dart
Also, here is my AndroidManifest.xml file: https://github.com/Andrewngabriel/radio-player/blob/v0.1/android/app/src/main/AndroidManifest.xml

I would appreciate any help or pointers on this. Thanks 🙂

Crash while playing audio

E/AndroidRuntime( 6676): java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 6676): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:148)
E/AndroidRuntime( 6676): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:239)
E/AndroidRuntime( 6676): 	at com.google.flutter.plugins.audiofileplayer.AudiofileplayerPlugin.lambda$onLoad$1$AudiofileplayerPlugin(AudiofileplayerPlugin.java:296)
E/AndroidRuntime( 6676): 	at com.google.flutter.plugins.audiofileplayer.-$$Lambda$AudiofileplayerPlugin$A6LKsuboaeEM7gfQPisQG3fhlSg.onRemoteLoadComplete(Unknown Source:11)
E/AndroidRuntime( 6676): 	at com.google.flutter.plugins.audiofileplayer.RemoteManagedMediaPlayer.onError(RemoteManagedMediaPlayer.java:113)
E/AndroidRuntime( 6676): 	at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3461)
E/AndroidRuntime( 6676): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 6676): 	at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime( 6676): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime( 6676): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6676): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime( 6676): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process ( 6676): Sending signal. PID: 6676 SIG: 9

Add more iOS audio categories

User is using a recorder plugin (which uses the 'play and record' category), and there seems to be issues with audiofileplayer (which can only set playback and ambient categories). Try adding an option to set the audio category to 'play and record'

Problem with Duration

I found a problem with the value that Duration Function provides. I noticed the error when I implemented the function in the BlockScreen notification window. The system slider (of iOS) did not move properly and terminated or before or after. I tried to compare the result that the Duration function provided and the actual length of the file and did not actually match.

I init the variable
double _audioDurationSeconds;

I load the file
_audio = Audio.load(
'assets/audios/${myVarList[indexVar][indexGo]}',
onComplete: () => setState(() => myComplete()),
onDuration: (double durationSeconds) =>
setState(() => _audioDurationSeconds = durationSeconds),
playInBackground: true,
);

I set metaData
AudioSystem.instance.setMetadata(AudioMetadata(
title: "${interfaceTexts.itInterfaceTexts["myText"]} ${resulVarList[0]}",
artist: myListTextMystery[indexVar][0] + " - " + myLabel,
durationSeconds: _audioDurationSeconds,
artBytes: imageBytes));

The result of _audioDurationSeconds don't match with the real duration of file (I see in the info windows) of the file. In each case a second less, in other a second more...

Notification Issue - Seek bar does not work at First - IOS & Android

Hey guys I read that AudioSystem.instance.setPlaybackState(true, _backgroundAudioPositionSeconds)
sets the seekBar on the notification however position and duration do not appear the first time I play something. If I pause and play again from the notification it works but it doesn't start automatically.

I set to true when Resume and to false when Pausing as suggested.

The issue Im having is only the first time the notification is set, the seek bar doesn't work until i pause and play again.

Any help would be appreciated, thanks.

edit:
Using Iphone X, on ios 13

edit:
Also happens on Android, Pixel 4 XL Android 10-11.

Error with Android when I RUN in RELEASE MODE

When I try to run in release mode my app (but the same error is show in Example too) I have in Run console this error
Schermata 2020-01-04 alle 11 40 36
I have do the change in Manifest like suggest. But also here there's a message error
Schermata 2020-01-04 alle 11 56 02
The app is also installed but it has the same problem as before: The audio interrupts after a few minutes.

Crashing while application on background.

Hello,
I'm using this package to handle media buttons in my application. It's little bit hacked, coz I'm actually not playing any audio just listening to events via addMediaEventListener. But when I the application is on the background and I trigger event it crashes.

D/AndroidRuntime( 9235): Shutting down VM
E/AndroidRuntime( 9235): FATAL EXCEPTION: main
E/AndroidRuntime( 9235): Process: com.mcc.project.rafi, PID: 9235
E/AndroidRuntime( 9235): java.lang.NullPointerException: Attempt to invoke interface method 'void com.google.flutter.plugins.audiofileplayer.AudiofileplayerService$ServiceListener.onMediaButtonClick(int)' on a null object reference
E/AndroidRuntime( 9235): at com.google.flutter.plugins.audiofileplayer.AudiofileplayerService$MediaSessionCallback.onMediaButtonEvent(AudiofileplayerService.java:340)
E/AndroidRuntime( 9235): at android.support.v4.media.session.MediaSessionCompat$Callback$StubApi21.onMediaButtonEvent(MediaSessionCompat.java:1400)
E/AndroidRuntime( 9235): at android.support.v4.media.session.MediaSessionCompatApi21$CallbackProxy.onMediaButtonEvent(MediaSessionCompatApi21.java:190)
E/AndroidRuntime( 9235): at android.media.session.MediaSession$CallbackMessageHandler.handleMessage(MediaSession.java:1578)
E/AndroidRuntime( 9235): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime( 9235): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 9235): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 9235): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9235): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 9235): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process ( 9235): Sending signal. PID: 9235 SIG: 9

How to set custom notification UI in Android?

Thank you for this stable plugin for audio. However, I can't find any way to set custom UI for audio notification in Android. Is it possible to change the position of media buttons (change margin and alignment) and perhaps the height of notification?
If it is not possible, what should I change to make it accessible?

background in iOS work in simulator but not in my iPhone Pro Max

I tried the plugin with the example you made. Thank you for your work. It works fine. I've only found one problem for now: play in background with iOS. It works in simulator but not in release mode with the device (I've an iPhone pro max with iOS 13.2.3).
Thanks
Carlo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.