Giter Site home page Giter Site logo

audio_manager's Introduction

Hi everyone 👋

I‘m love the open source Jerome Xiong, I mainly use Swift and JavaScript to write code, but I insist on studying. I am currently doing my own open source project audio_manager, using flutter audio playback written by dart. Welcome everyone to open source.

Quick overview

  • GitHub stats:

    My github stats
  • Welcome everyone to my personal blog

audio_manager's People

Contributors

jeromexiong avatar joelfickson avatar patricevignola 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

Watchers

 avatar  avatar  avatar  avatar  avatar

audio_manager's Issues

iOS Crash on release mode

Currently experiencing a problem where the app sometime crashes only in release mode. Any ideas on how to decode the IOS Crash log, i've attached a small section of the crash log below.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000004111401c
VM Region Info: 0x4111401c is not in any region.  Bytes before following region: 3209592804
      REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                 00000001005fc000-0000000100600000 [   16K] r-x/r-x SM=COW  ...er.app/Runner

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [1113]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libobjc.A.dylib                 0x000000019c3c74ac object_isClass + 16 (objc-runtime-new.h:340)
1   Foundation                      0x000000019ca551a8 KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED + 44 (NSKeyValueObserving.m:1120)
2   Foundation                      0x000000019ca52cd0 NSKeyValueWillChangeWithPerThreadPendingNotifications + 272 (NSKeyValueObserving.m:1151)
3   AVFoundation                    0x00000001a6896348 -[AVPlayerItem _informObserversAboutAvailabilityOfTracks] + 56 (AVPlayerItem.m:3722)
4   AVFoundation                    0x00000001a6899374 -[AVPlayerItem _respondToBecomingReadyForBasicInspectionWithDuration:] + 296 (AVPlayerItem.m:4358)
5   AVFoundation                    0x00000001a68ae580 __avplayeritem_fpItemNotificationCallback_block_invoke + 2080 (AVPlayerItem.m:8874)
6   libdispatch.dylib               0x000000019c36b9a8 _dispatch_call_block_and_release + 24 (init.c:1408)
7   libdispatch.dylib               0x000000019c36c524 _dispatch_client_callout + 16 (object.m:495)
8   libdispatch.dylib               0x000000019c31e5b4 _dispatch_main_queue_callback_4CF$VARIANT$mp + 904 (inline_internal.h:2484)
9   CoreFoundation                  0x000000019c624748 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1749)
10  CoreFoundation                  0x000000019c61f61c __CFRunLoopRun + 1724 (CFRunLoop.c:3069)
11  CoreFoundation                  0x000000019c61ec34 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
12  GraphicsServices                0x00000001a676838c GSEventRunModal + 160 (GSEvent.c:2246)
13  UIKitCore                       0x00000001a075122c UIApplicationMain + 1932 (UIApplication.m:4820)
14  Runner                          0x0000000100603380 main + 88 (main.m:7)
15  libdyld.dylib                   0x000000019c4a6800 start + 4

....

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x00000002809c1740   x1: 0x000000016f802310   x2: 0xfffffffffffffff0   x3: 0x000000016f802310
    x4: 0x0000000000000008   x5: 0x0000000000000010   x6: 0x0000000000000000   x7: 0x00000000000002d0
    x8: 0x0000000041114000   x9: 0x00000002809c2df0  x10: 0x00000002809cd4a0  x11: 0x00000002809cf780
   x12: 0x00000002809cd4a0  x13: 0x00000002809cf780  x14: 0x00000002809cfb40  x15: 0x00000002809ce4c0
   x16: 0x000000019c3ae8f0  x17: 0x000000019c58f928  x18: 0x0000000000000000  x19: 0x000000016f802310
   x20: 0x0000000000000008  x21: 0x00000002809c1740  x22: 0x000000028055e940  x23: 0x00000002807350c0
   x24: 0x0000000000000008  x25: 0x0000000000000000  x26: 0x0000000000000008  x27: 0x000000016f802310
   x28: 0x0000000000000000   fp: 0x000000016f802300   lr: 0x000000019ca551a8
    sp: 0x000000016f8022e0   pc: 0x000000019c3c74ac cpsr: 0x20000000
   esr: 0x92000005 (Data Abort) byte read Translation fault

Double entrys in android notification center

Screenshot_1588324158

Song list used:

final list = [
{
"title": "Ambia",
"desc": "Taeo Kol",
"url": "https://www.basicmethods.org/mp3/BM_traxx_25.mp3",
"coverUrl": "https://www.countrymusicnews.de/images/stories/cd/RodneyAtkins-CaughtUpInTheCountryLP.jpg"
},
{
"title": "Terror",
"desc": "Taeo Kol",
"url": "https://dreaddymck.com/Public/MUSIC/FEATURING/project%2081.mp3",
"coverUrl": "https://images.rapgenius.com/ed068b8684cbf71e619ed940d37b0b80.900x892x1.jpg"
},
{
"title": "Confusing",
"desc": "Ministri",
"url": "https://ia800305.us.archive.org/30/items/return_201605/return.mp3",
"coverUrl": "https://static.vibe.com/uploads/2015/01/MCM9.jpg"
},
{
"title": "Dromeda",
"desc": "Ministri",
"url": "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/Creative_Commons/Dead_Combo/CC_Affiliates_Mixtape_1/Dead_Combo_-01-_Povo_Que_Cas_Descalo.mp3",
"coverUrl": "https://static.vibe.com/uploads/2015/01/MCM7-600x600.jpg"
}
];

I have the following issue using your example code with the above song list. If you play a song from the list and navigate to the next song via notification center, it seems like a second mediaplayer is opening there.

Another question: In my app im highlighting the list item which is currently playing via a global index. If I navigate in the android notification center to next song, my highlighted song doesnt update, because I don't know which function I have to call. Which code is called if I press the arrows on notification center? How can I update the song item? Thank you.

Can't cancel or skip AudioManager.instance functions or remove background activity

Hey Jerome,

Im facing an issue for both android and ios where Im not able to move to the next item in my pageview as long as the AudioManager.instance.next function is part of the function tree. None of the AudioManager functions are skipable. They basically block the Pageview controlls.

As you will see in my demo, if I slide to the next element, its getting stuck completely, it doesnt let me override the previous action. Also If I press the close button with AudioManager.instance.stop function. It will either get stuck or it wont stop and song will be played on different screen.

This is another or combining issue. If you call the AudioManager.instance.stop(); function and move to a different screen, the song doesnt stop, it continues playing on a different screen. On iOS you can clearly see that this behaviour happens if you slide threw the items and close the screen. It doesnt get recognized anymore. If I put a print in a dispose tree, it will get printed but it doesnt dispose the Audio if you move to a different screen.

In the following im providing you a fully working demo with audio sources from my firebase project. You can test and reproduce the error there. Im also providing 2 videos, one with android from stackoverflow user, where it just looks fine and one from me with iOS, where you can clearly see that it starts playing audio even if we call AudioManager.instance.stop();

Videos:
Android: https://streamable.com/sepgb1
iOS: https://streamable.com/e/ycxwob

import 'package:audio_manager/audio_manager.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    // Page selector for tab list
    void _selectPage(int index) {
      print('page index: $index');
      setState(() {
        currentIndex = index;
      });
    }

    // Routes list for tab navigation Android
    final List<Widget> _pages = [
      ScreenA(),
      ScreenB(func: _selectPage),
    ];

    return Scaffold(
      appBar: AppBar(),
      body: _pages[currentIndex],
      bottomNavigationBar: SafeArea(
        child: BottomNavigationBar(
          onTap: _selectPage,
          iconSize: 22,
          currentIndex: currentIndex,
          type: BottomNavigationBarType.fixed,
          items: [
            BottomNavigationBarItem(
              backgroundColor: Theme.of(context).primaryColor,
              icon: Icon(Icons.description),
              label: 'ScreenA',
            ),
            BottomNavigationBarItem(
                backgroundColor: Theme.of(context).primaryColor,
                icon: Icon(Icons.ac_unit_outlined),
                label: 'ScreenB'),
          ],
        ),
      ),
    );
  }
}

class ScreenA extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Text('HOME'),
    );
  }
}

class ScreenB extends StatefulWidget {
  Function func;
  ScreenB({Key key, @required this.func}) : super(key: key);
  @override
  _ScreenBState createState() => _ScreenBState();
}

var audioFiles = [
    "https://docs.google.com/uc?export=open&id=1SaJWqfQuHnFtL7uqrzfYG31hzOnqDM3r",
    "https://docs.google.com/uc?export=open&id=1FZkFMjQyWguAl0RMAsYDEZ07c_Qf7gjz",
    "https://docs.google.com/uc?export=open&id=1GqrwQ3eRuiil0p-Na_R1tMAvggp9YrbH",
  ];
var audioIndex = 0;

class _ScreenBState extends State<ScreenB> {

  var _controller = PageController();
  PlayMode playMode = AudioManager.instance.playMode;

  var globalIndex =0;

  @override
  void initState() {
    // TODO: implement initState
    
    List<AudioInfo> _list = [];
    for (var i = 0; i < audioFiles.length; i++) {
      _list.add(AudioInfo(audioFiles[i], coverUrl: '', desc: '', title: ''));
    }

    print(_list);

    AudioManager.instance.audioList = _list;
    AudioManager.instance.intercepter = true;
    AudioManager.instance.play(auto: true);

    super.initState();
  }


@override
void dispose() {
    // TODO: implement dispose
    AudioManager.instance.release();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: [
          IconButton(
            icon: Icon(Icons.close),
            onPressed: () {
              AudioManager.instance.stop();
              widget.func(0);
            },
          ),
        ],
      ),
      body: PageView.custom(
          dragStartBehavior: DragStartBehavior.start,
          controller: _controller,
          physics: NeverScrollableScrollPhysics(),
          scrollDirection: Axis.horizontal,
          childrenDelegate: SliverChildBuilderDelegate((ctx, pageIndex) =>
              GestureDetector(
                  onPanUpdate: (details) {
                    if (details.delta.dx < 0) {
                      _controller.nextPage(
                          duration: Duration(milliseconds: 200),
                          curve: Curves.easeInOut);

                      setState(() {
                        //audioIndex = pageIndex;
                        AudioManager.instance.next();
                      });
                      
                    }
                  },
                  child: Center(
                      child: Container(
                          width: 200,
                          height: 200,
                          color: Colors.red,
                          child: Text(audioFiles[audioIndex])))))),
    );
  }
}

**** Since 0.5.5 AVPlayer doesnt work correct anymore ****

Since the newest version, AVPlayer is totally broken. in 0.5.4+1 everything worked perfectly.

If you play next song, sometimes its not playing anymore because it jumps from one song to another, it is flicking all the time and it is changing the index randomly. if you go back in the app then, the selected item which is actually playing is jumping all the time.

Pls roll this back or fix it...!

video: https://streamable.com/5jskjy

Change language

Hello. Thanks for the great package

However, I'm wondering if there is any simple way to change the package language ? I get controls from control center and callbacks, errors and stuff in chinese

Notification Panel still exits even after clearing the playlist

Hi,

I'm using version - 0.5.7+1

While trying to support a 'clear playlist' functionality, I do the following steps

await AudioManager.instance.stop();
await AudioManager.instance.release();
AudioManager.instance.audioList.clear();

But I still see the notification panel open with the last song, while the actual playlist is empty.
Also, click on the notification panel doesn't execute any operation.

Can you please let me know, if I'm missing any step or is it a bug to be handled?

Poongs

Repeat one not working on local file

Hi, thanks for good package..
I try use your package on android, but on repeat one, after audio finish, just stop, audio not repeat again..
thanks..
sorry for bad english..

fix index new audiolist

when playing a track with an index greater than the length of the new list, this causes an error

Events repeat callbacks

I use your example, When call start method in instance, onEvent repeated callback.

flutter: AudioManagerEvents.timeupdate, {position: 2004, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2004, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2005, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2005, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2006, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2006, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2007, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2007, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2008, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 2008, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3001, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3002, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3002, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3003, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3003, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3004, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3004, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3004, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3005, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3005, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3006, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3006, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3007, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3007, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3008, duration: 372715}
flutter: AudioManagerEvents.timeupdate, {position: 3008, duration: 372715}
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false
flutter: AudioManagerEvents.playstatus, false

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76,
locale ru-RU)
• Flutter version 1.12.13+hotfix.8 at /Users/reuf/development/flutter
• Framework revision 0b8abb4724 (11 days ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0

iOS 13.3

Crush while playing androin audio in offline

W/System.err(16607): java.net.UnknownHostException: Unable to resolve host "pbs.twimg.com": No address associated with hostname
W/System.err(16607): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
W/System.err(16607): at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
W/System.err(16607): at java.net.InetAddress.getAllByName(InetAddress.java:1152)
W/System.err(16607): at com.android.okhttp.Dns$1.lookup(Dns.java:41)
W/System.err(16607): at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:178)
W/System.err(16607): at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144)
W/System.err(16607): at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:86)
W/System.err(16607): at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:176)
W/System.err(16607): at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
W/System.err(16607): at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
W/System.err(16607): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
W/System.err(16607): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
W/System.err(16607): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
W/System.err(16607): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
W/System.err(16607): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:248)
W/System.err(16607): at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211)
W/System.err(16607): at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30)
W/System.err(16607): at cc.dync.audio_manager.MediaPlayerService.getBitmapFromUrl(MediaPlayerService.java:281)
W/System.err(16607): at cc.dync.audio_manager.MediaPlayerService.lambda$updateCover$0$MediaPlayerService(MediaPlayerService.java:236)
W/System.err(16607): at cc.dync.audio_manager.-$$Lambda$MediaPlayerService$JSqC9Btt6eaYwxL-BEuUfDf3fYc.run(Unknown Source:4)
W/System.err(16607): at java.lang.Thread.run(Thread.java:919)
W/System.err(16607): Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/System.err(16607): at libcore.io.Linux.android_getaddrinfo(Native Method)
W/System.err(16607): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:74)
W/System.err(16607): at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:200)
W/System.err(16607): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:74)
W/System.err(16607): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
W/System.err(16607): ... 20 more
E/AndroidRuntime(16607): FATAL EXCEPTION: Thread-3
E/AndroidRuntime(16607): Process: music.fox_music, PID: 16607
E/AndroidRuntime(16607): java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.InputStream.close()' on a null object reference
E/AndroidRuntime(16607): at cc.dync.audio_manager.MediaPlayerService.getBitmapFromUrl(MediaPlayerService.java:290)
E/AndroidRuntime(16607): at cc.dync.audio_manager.MediaPlayerService.lambda$updateCover$0$MediaPlayerService(MediaPlayerService.java:236)
E/AndroidRuntime(16607): at cc.dync.audio_manager.-$$Lambda$MediaPlayerService$JSqC9Btt6eaYwxL-BEuUfDf3fYc.run(Unknown Source:4)
E/AndroidRuntime(16607): at java.lang.Thread.run(Thread.java:919)
I/Process (16607): Sending signal. PID: 16607 SIG: 9
Lost connection to device.

Song takes really long starting with bluetooth device e.g. Air Pods Pro on network

When app is connected to car via Bluetooth or I have my AirPods Pro connected to my iPhone, it takes double of time until song is starting.

It has a similar behaviour to #29
Like I describe there, the following code should make everything on iOS start faster on network:

AVPlayer *player = playerInfo[@"player"];

float playbackRate = [playerInfo[@"rate"] floatValue];

if (@available(iOS 10.0, *)) {
    [player playImmediatelyAtRate:playbackRate];
} else {
    [player play];
}
Apple dev

documentation:
https://developer.apple.com/documentation/avfoundation/avplayer/1643480-playimmediatelyatrate?language=objc

App notification category is displayed in Chinease

Hi,

Go to Settings -> Apps & Notifications --> Select your app using audio_manager --> Select Notifications.

You will see the notification category listed in Chinese.

Can this be changed to english.

Poongs
NotificationName

Notification Center & Lockscreen on IOS shows song of apple music if I press on previous or next button

Hello,

following issue im experiencing at the moment testing my app with your plugin. If I click on a song in my app and switch into lockscreen, it shows the relevant information from my app and everything works fine. If I press on previous or next button from lockscreen, meanwhile it shows a song from my apple music playlist until the next song from my app successfully loaded.

Im also able to play the apple music song when it is showing. Then the route to my app doesnt exist anymore and it gets stuck. Could you fix this please?

iOS - changing index and playing throws 'Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVPlayerItem seekToTime:toleranceBefore:toleranceAfter:completionHandler:] Seeking is not possible to time {INVALID}'

  1. Added list of info to AudioManager
  2. When a custom index is selected, changed index in play (index: index)
  3. App got terminated with error code
    'Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVPlayerItem seekToTime:toleranceBefore:toleranceAfter:completionHandler:] Seeking is not possible to time {INVALID}'

Details:
Device: iPad iOS 9.3.5

No implementation found for method start on channel

There seems to be no implementation for the start command
also, the command doesn't validate the cover is not null before attempting to run regex on it

E/flutter ( 7417): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method start on channel audio_manager)
E/flutter ( 7417): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)

Array out of bounds

当我修改了播放列表的时候,当前播放下标仍然是之前的播放下标,能否让播放下标跟随播放列表进行改变,或者播放下标交由外界维护

How can i reset AudioManager.instance state?

Currently, I use this plugin to play a single audio. I start with a screen suck as player screen then if the user finished this screen the audio with stop too. if I start that screen again and play the same audio with previously but AudioManager not working for this case.
another case:

  • Android: if I close play by media notification and play again with the same audio then AudioManager not working too ( for this case: how can I listen close event by media notification for reset AudioManager.instance state or something else)

Thanks a lot.

Local file coverUrl not working on Android

Hi
On Android coverUrl not working.
I got exception
V/AudioManagerPlugin(17668): 播放错误:java.io.FileNotFoundException: file:///data/user/0/com.blizejprzedszkola.app.mojaplytoteka/app_flutter/covers/17_cover.jpg
and
I/flutter (17668): AudioManagerEvents.error, java.io.FileNotFoundException: file:///data/user/0/com.blizejprzedszkola.app.mojaplytoteka/app_flutter/covers/17_cover.jpg
On iOS everything works fine.

Playing Streaming Audio

Thanks for the Plugin and the support to Flutter Community =)

I need play the streaming audio, but when I set in .start method I got this error:

D/MediaBrowserCompat( 1847): Connecting to a MediaBrowserService.
V/AudioManagerPlugin( 1847): --stop
E/MediaPlayerHelper( 1847): 媒体资源加载失败
V/AudioManagerPlugin( 1847): --播放错误
V/AudioManagerPlugin( 1847): 播放错误:媒体资源加载失败
V/AudioManagerPlugin( 1847): --stop

This is my link to stream audio: http://srv9.abcradio.com.br:7002/listen.mp3

playing local file

Playing local file ( file://${file.path} ) doesn't work and crashes the app.
can you fix it ?

Notification related

When I click close in the notification bar, the player will enter the stop, but the app does not refresh
AudioManager.instance.isPlaying will not become false
Can the status of the stop be exposed?

Change android notification icons

Thank you for this lib, it's really helped me!

I was wondering if it's possible to change the icons on the notification? And how can I remove the 'next' button if there's only one item in the queue?
Thanks again!

Can't play local audio files

It always searches the file inside the flutter_assets directory.
I have local files to play. How do I do that?

Timestamp for iOS/android

Hello what’s up and great plugin, love it!

I saw in my emulator iOS and Android controllcenter view timestamp of Song which is played.

Can you change timestamp to something more compact and beautiful like this for example:

At the moment: 0:00:000000 - 0:00:000000
To this: 0:00:0 - 0:00:0

App crashes on iOS when Preloading other playback information

Hello

The app crashes when I am currently playing an audio file, and I try to Preload other audio info with AudioManager.instance.start(...) to play an other audio (on iOS only (real device and simulator))

What is the proper way to stop the currently played audio and then start a new one (from a different URL) when a button is clicked for instance ?

How to cancel Audio Manager loading resource

Hello @jeromexiong ,

I have a specific case, but who knows maybe someone else does need this information. In my app I have a carousel and each slide is showing an image and loading a song file. Now I can slide to right and left, but it only lets me slide if the song is initialized. I already tried AudioManager.instance.stop() and AudioManager.instance.playandpause() but it wont stop initializing the song.

I already connected all AudioManager events with providers, but I dont know how to make the loading process cancelling. Do you have any idea?

local file

Can I play local file stored in Document folder?

Buffering Songs on iOS not working immediately

Hello, buffering on iOS with WLAN off is not working as expected. (Please check it on android too) I tested it on several real iPhones, if WLAN is off and I use LTE or other mobile network, song starts playing first, when complete song is initialized, and then it starts buffering at very last. This causes waiting for song start playing very long time. It is wrong order. If wlan is on, song directly starts playing and buffering like it should

Please fix this on WLAN off mode, this is really annoying. Thank you!

Highlight currently playing Song in list

If I set color for index on currently playing Song everything works fine. If I go to next song via Notification Center on iOS/android, Song index doesn’t refresh highlighted Song index.

Im using Audiomanager.instance.curIndex for displaying highlighted song, but it doesn’t refresh if you go to next song via Notification Center iOS/android

Does this support Web?

On the pub.dev page this project lists support for Flutter for Web. Is this accurate?

'void android.media.MediaPlayer.start()' on a null object reference when trying to play local files

I/flutter ( 7308): status false
I/flutter ( 7308): AudioManagerEvents.start, AudioInfo{url: file:///storage/emulated/0/Android/data/com.mouridepro.android/files/mesaudios/Ahaazanil Baaqii.aac, title: Ahaazanil Baaqii, desc: enregistrement}
I/flutter ( 7308): start load data callback, curIndex is 0
V/AudioManagerPlugin( 7308): --stop
I/flutter ( 7308): Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference

How can I rebuild only single widgets of my app

Hey there Hope you can help me out. I’m using the following code in my main.dart file:

String _platformVersion = 'Unknown';
bool isPlaying = false;
Duration _duration;
Duration _position;
double _slider;
double _sliderVolume;
String _error;
num curIndex = 0;
PlayMode playMode = AudioManager.instance.playMode;

final list = [
{
"title": "Assets",
"desc": "local assets playback",
"url": "assets/audio.mp3",
"coverUrl": "assets/ic_launcher.png"
},
{
"title": "network",
"desc": "network resouce playback",
"url": "https://dl.espressif.com/dl/audio/ff-16b-2c-44100hz.m4a",
"coverUrl": "https://homepages.cae.wisc.edu/~ece533/images/airplane.png"
}
];

@OverRide
void initState() {
super.initState();

initPlatformState();
setupAudio();
// loadFile();

}

@OverRide
void dispose() {
// 释放所有资源
AudioManager.instance.stop();
super.dispose();
}

void setupAudio() {
List _list = [];
list.forEach((item) => _list.add(AudioInfo(item["url"],
title: item["title"], desc: item["desc"], coverUrl: item["coverUrl"])));

AudioManager.instance.audioList = _list;
AudioManager.instance.intercepter = true;
AudioManager.instance.play(auto: false);

AudioManager.instance.onEvents((events, args) {
  print("$events, $args");
  switch (events) {
    case AudioManagerEvents.start:
      print("start load data callback");
      _position = AudioManager.instance.position;
      _duration = AudioManager.instance.duration;
      _slider = 0;
      setState(() {});
      break;
    case AudioManagerEvents.ready:
      print("ready to play");
      _error = null;
      _sliderVolume = AudioManager.instance.volume;
      _position = AudioManager.instance.position;
      _duration = AudioManager.instance.duration;
      setState(() {});
      // if you need to seek times, must after AudioManagerEvents.ready event invoked
      // AudioManager.instance.seekTo(Duration(seconds: 10));
      break;
    case AudioManagerEvents.seekComplete:
      _position = AudioManager.instance.position;
      _slider = _position.inMilliseconds / _duration.inMilliseconds;
      setState(() {});
      print("seek event is completed. position is [$args]/ms");
      break;
    case AudioManagerEvents.buffering:
      print("buffering $args");
      break;
    case AudioManagerEvents.playstatus:
      isPlaying = AudioManager.instance.isPlaying;
      setState(() {});
      break;
    case AudioManagerEvents.timeupdate:
      _position = AudioManager.instance.position;
      _slider = _position.inMilliseconds / _duration.inMilliseconds;
      setState(() {});
      AudioManager.instance.updateLrc(args["position"].toString());
      break;
    case AudioManagerEvents.error:
      _error = args;
      setState(() {});
      break;
    case AudioManagerEvents.ended:
      AudioManager.instance.next();
      break;
    case AudioManagerEvents.volumeChange:
      _sliderVolume = AudioManager.instance.volume;
      setState(() {});
      break;
    default:
      break;
  }
});

}

Now when I’m playing next song for example setstate will refresh my whole app. How can I only rebuild a specific file of my project when event is triggered?

For example let’s say we have main.dart file home.dart , news.dart and on event AudioManagerEvents.next I only want setstate for my file News.dart, how to do this?

Thank you for the help!

Audio Player issue

The stop button does not reset the playing audio. The audio just paused there and when play button is pressed, it give this error

I/flutter (12726): AudioManagerEvents.error, you must invoke the [start] method after calling the [stop] method

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.