GithubHelp home page GithubHelp logo

brianwernick / playlistcore Goto Github PK

View Code? Open in Web Editor NEW
89.0 89.0 25.0 882 KB

Media Playlist Service With Notification and Remote View Support

License: Apache License 2.0

Kotlin 100.00%
android media-library notifications playlist

playlistcore's People

Contributors

brianwernick avatar gounlaf avatar jyh149129 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

Watchers

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

playlistcore's Issues

Audio URL not working

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.1
Reproduction Steps

When i play below URL it's working in your code. but works in VLC player.
http://demo.eonssofttech.co/muzica/assets/uploads/album_data/el-perdedor.mp3
Above URL works in iOS,Web and BB.

This URL works
http://demo.eonssofttech.co/muzica/assets/uploads/album_data/Six-Days.mp3

Actual Result

Showing me UNKNOWN_ERROR which playing give URL.

Please check why this Audio not working.

how we replay the whole playlist?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.0.1
  • Device OS version: 6.0
  • Devide Manufacturer: Huawei
  • Device Name: Nexus 6P
Reproduction Steps
Expected Result
Actual Result

Play the audio with seek position time greater than zero makes it play a bit of their beginning

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.0
  • Device OS version: 5.0.2
  • Devide Manufacturer: HTC
  • Device Name: One X
Reproduction Steps
  1. Change the seekPosition field in method playlistManager.play(0, false); in AudioPlayerActivity.java to any value greater than 0, i.e.: playlistManager.play(10000, false);
  2. Wait audio to play.
Expected Result

Start playing the audio exactly at the given seekPosition

Actual Result

After the audio loads it starts from 0 and play a little ms than jumps to seekPosition, in the meantime I can hear the audio plays a bit of their beginning.

Allow app to disable all ducking

  • I have verified there are no duplicate active or recent bugs, questions, or requests

Currently the app can't disable ducking with out overriding the audio focus helper.
It would be nice to allow for different audio types (MUSIC, VERBAL, etc) where some allow ducking and some do not.

Seek media item by time amount without pausing

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.1
  • Device OS version: 5.0.2
  • Devide Manufacturer: HTC
  • Device Name: One X

I'm developing a feature that user can seek media item position by x amount of time in a button click. Let's say the amount is 15 seconds, so I need to do the following:

int seekAmount = 15000;
playlistManager.invokeSeekStarted();
playlistManager.invokeSeekEnded((int) mediaProgress.getPosition() + seekAmount);

But this pauses the audio for a while, and I want to seek on the fly. If I just call invokeSeekEnded() without the the invokeSeekStarted() playbackState stucks in SEEKING state.

Expected Result

I expected just call invokeSeekEnded without seek started event, because this is redundant in this case. Or to have a custom method to seek without pausing the audio, with will just move the playback position without changing playbackState.

Play the audio with skipping certain time will keep the loading progress bar showing

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • ExoMedia version: 3.0
  • Device OS version: 6.0
  • Devide Manufacturer: LG
  • Device Name: Nexus 5
Reproduction Steps
  1. change the method
    playlistManager.play(0, false); in AudioPlayerActivity.java
    to
    playlistManager.play(50 * 1000, false);
  2. Play the audio, the loading progress bar will be keeping showing because the last playback state update is SEEKING rather than play.
Expected Result

the loading progress bar disappears and plays the audio starting with 50 seconds.

Actual Result

the loading progress bar did not disappear but the audio starts with 50 seconds.

Async bitmap loading.

  • I have verified there are no duplicate active or recent bugs, questions, or requests

This is actually not a bug but a suggestion for an improvement. The only thing that's holding me back from using this lib in my app is, that I'm forced to return the Bitmaps synchronously.

EDIT: My bad, haven't seen that it's possible to manually initiate a notification update.

Unexpected media repeat

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Version
  • PlaylistCore version: 2.0.0
Reproduction Steps

The issue is reproducible in the project demo:

  1. Play the latest media of the playlist queue.
  2. Seek the progress to the end.
  3. Wait for the playback finish.
Expected Result

When the latest media in the playlist finishes it should change the playback state to stopped.

Actual Result

When the latest media in the playlist queue finishes the media is being played again.

Ability to disable the big/expanded notification

  • I have verified there are no duplicate active or recent bugs, questions, or requests

Currently when the OS version supports it we always provide a big (expanded) notification.
It would be nice to allow disabling this for applications that don't have much information on the media being played.

Question: How to play the next track on Error

Hello, I want to play the next song when retryCount == MAX_RETRY_COUNT
I've tried modifiying PlayListServiceCore

public boolean retryAudio() {
if (currentItemIsType(BasePlaylistManager.AUDIO) && ++retryCount <= MAX_RETRY_COUNT) {
Log.d(TAG, "Retrying audio playback. Retry count: " + retryCount);
playAudioItem();
return true;
}else{
performNext();
performPlay();
}
return false;
}

This does not work. What I should do? Thks

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.3
  • Device OS version: 7.0
  • Devide Manufacturer: Motorola
  • Device Name: Moto G4 Plus
Reproduction Steps
Expected Result
Actual Result

Add N notification styling

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.1
  • Device OS version: 6.0
  • Devide Manufacturer: Huawei
  • Device Name: Nexus 6P

The notification doesn't follow the new android N styling. See Google Play Music for an example

Weird status after playing an failed audio

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.1
  • Device OS version: 6.0
  • Devide Manufacturer: HTC
  • Device Name: One X
Reproduction Steps
  1. Play some audio with slow network connection and wait for Error status
  2. Wait for onPlaybackStateChanged() to be called with: playbackState = [ERROR]
  3. Try to play the same audio again
Expected Result

The audio replayed start on PREPARING state

Actual Result

The audio replayed is starting on PLAYING state, but it get stuck and nothing happens

Help: getNotificationClickPendingIntent() method pass value to activity

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.3
  • Device OS version: 5.0
  • Devide Manufacturer: xiaomi
    my ccode :
   @NonNull
    @Override
    protected PendingIntent getNotificationClickPendingIntent() {
        if(currentPlaylistItem!= null) {
            intent = new Intent(this, AudioStationPlay_JcPlayerActivity.class);
           // i want pass  param to AudioStationPlay_JcPlayerActivity
            intent.putExtra("cid", currentPlaylistItem.getPlaylistId()); // vlaue 4
            intent.putExtra("pid", 1);
            return PendingIntent.getActivity(this, FOREGROUND_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        } else
            return PendingIntent.getActivity(getApplicationContext(), FOREGROUND_REQUEST_CODE, new Intent(getApplicationContext(), AppStart.class), PendingIntent.FLAG_UPDATE_CURRENT);
    }

In AudioStationPlay_JcPlayerActivity i can't get the "cid" and "pid" value(both log out value "0") why?

sorry my bad englisth...

Update buttons displayed at notifications section

Sorry for re-open this question about when we have just one media item in our PlayListManager, the notification section displays just the play/pause button.

I was trying to reach the updateNotification() method from every class i used but i got no luck, because it is at MediaService level - (or i dont know how to expose it)

Is it possible to expose it at the ListPlaylistManager level?? the class the extends BasePlaylistManager. or can you guide me to reach that method please??

I have created the following method on a new class that extends the "ListPlaylistManager"

public void addItem(I item) {
        if (this.items == null) {
            this.items = new ArrayList<>();
        }

        this.items.add(item);

        //noinspection SynchronizeOnNonFinalField
        synchronized (this.items) {
            this.items.notify();
        }
    }

it works fine but i'd like to update the notification right from here after the item was added or call PlayListManager.updateNotification();

help me please!!

-Using lib PlaylistCore version: 1.1.1

How to loop playlist !

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.0.1
  • Device OS version: 6.0
  • Devide Manufacturer: Huawei
  • Device Name: Nexus 6P
Reproduction Steps
Expected Result
Actual Result

Show notification only when app is in foreground

  • I have verified there are no duplicate active or recent bugs, questions, or requests

Is possible to make the player notification only show when the apps goes to foreground state?

One of the reasons to do it Is because I only want to call methods like onLargeNotificationImageUpdated() and onRemoteViewArtworkUpdated() when the app is in foreground, because these methods are a little slow to execute and my application is skipping 100+ frames every time I change the current playing item.

Just for note, i'm using Glide instead Picasso (That was used in demo) to load bitmaps on notification update methods, but I think that's not the problem, i.e.:

    @Override
    protected void updateLargeNotificationImage(int size, MediaItem playlistItem) {
        Glide.with(this).load(playlistItem.getThumbnailUrl()).asBitmap()
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                        largeNotificationImage = resource;
                        onLargeNotificationImageUpdated();
                    }

                    @Override
                    public void onLoadFailed(Exception e, Drawable errorDrawable) {
                        super.onLoadFailed(e, errorDrawable);
                        largeNotificationImage = null;
                    }
                });
    }

    @Override
    protected void updateRemoteViewArtwork(MediaItem playlistItem) {
        Glide.with(this).load(playlistItem.getArtworkUrl()).asBitmap()
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                        remoteViewArtwork = resource;
                        onRemoteViewArtworkUpdated();
                    }

                    @Override
                    public void onLoadFailed(Exception e, Drawable errorDrawable) {
                        super.onLoadFailed(e, errorDrawable);
                        remoteViewArtwork = null;
                    }
                });
    }

Memory leaking

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 2.0.1
Reproduction Steps
  1. Play something
  2. Stop (playlistManager.invokeStop())

Repeat it

Expected Result

MediaServices will be collected by GC
2018-06-29 15 00 47

ArrayIndexOutOfBoundsException when playlist is empty

  • I have verified there are no duplicate active or recent bugs, questions, or requests

  • PlaylistCore version: 1.1.1 (probably lower version too)

  • Device OS version: 6.0 (probably lower version too)

  • Devide Manufacturer: Huawei (+emulator)

  • Device Name: Nexus 6P (+emulator)

Reproduction Steps
  1. Initialise the playlist manager
  2. Kill app
Expected Result

No crash expected

Actual Result
java.lang.ArrayIndexOutOfBoundsException: length=0; index=-1
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3314)
    at android.app.ActivityThread.-wrap21(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1565)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
 Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=-1
    at java.util.ArrayList.get(ArrayList.java:413)
    at com.devbrackets.android.playlistcore.manager.ListPlaylistManager.getItem(ListPlaylistManager.java:81)
    at com.devbrackets.android.playlistcore.manager.BasePlaylistManager.findNextAllowedPosition(BasePlaylistManager.java:707)
    at com.devbrackets.android.playlistcore.manager.BasePlaylistManager.setCurrentPosition(BasePlaylistManager.java:412)
    at com.devbrackets.android.playlistcore.service.PlaylistServiceCore.relaxResources(PlaylistServiceCore.java:1009)
    at com.devbrackets.android.playlistcore.service.BasePlaylistService.relaxResources(BasePlaylistService.java:223)
    at com.devbrackets.android.playlistcore.service.PlaylistServiceCore.onDestroy(PlaylistServiceCore.java:285)
    at com.devbrackets.android.playlistcore.service.BasePlaylistService.onDestroy(BasePlaylistService.java:168)
    at com.devbrackets.android.playlistcore.service.PlaylistServiceCore.onTaskRemoved(PlaylistServiceCore.java:329)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3299)
    at android.app.ActivityThread.-wrap21(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1565) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:154) 
    at android.app.ActivityThread.main(ActivityThread.java:6077) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 

How to play music when kill app

When i kill app, service kill. i want kill app then service play music continue play.
i setup
setupForeground();
and
public int getServiceContinuationMethod() {
return START_STICKY;
}

but not working.
plz help me

How avoid skipping to next song on duration at 0

Hello Sir I wan to play song s continuous so placed perform next () in performon complete listener ()
From that time when I was pressing list view it skips to next song while clicks on play button and progress bar same happened so please tell me the code to clear this issue which I want place on perform on complete listener ()
Please help me sir thanking u sir in advance

Override onerror in DefaultPlaylistHandler

Could you please show a example on how to override onerror in DefaultPlaylistHandler. I want to stop loading next mediaitem on error.

I tried the below code but its not working.

`public class DefaultPlaylistHandlerWithError extends DefaultPlaylistHandler {

    protected DefaultPlaylistHandlerWithError(Context context, Class serviceClass, BasePlaylistManager playlistManager, ImageProvider imageProvider, PlaylistNotificationProvider notificationProvider, MediaSessionProvider mediaSessionProvider, MediaControlsProvider mediaControlsProvider, AudioFocusProvider audioFocusProvider, Listener listener) {
        super(context, serviceClass, playlistManager, imageProvider, notificationProvider, MediaSessionProvider, mediaControlsProvider, audioFocusProvider, listener);
    }
    @Override
    public boolean onError(MediaPlayerApi mediaPlayerApi) {
        setPlaybackState(PlaybackState.ERROR);
        relaxResources();
        return false;
    }
}`

PlaylistCore 2.0.0 issue when disposing/resetting media players

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.0.1
  • Device OS version: 7.1.2
Reproduction Steps
  1. Start audio playback in the demo app
  2. Pause audio playback
  3. Swipe the media notification away
  4. Start audio playback again
Expected Result

Audio playback should start.

Actual Result

Audio playback does not start and an IllegalStateException is thrown:

08-18 11:26:57.072 27138-27138/com.devbrackets.android.playlistcoredemo W/MessageQueue: Handler (android.os.Handler) {f9f7351} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {f9f7351} sending message to a Handler on a dead thread
    at android.os.MessageQueue.enqueueMessage(MessageQueue.java:543)
    at android.os.Handler.enqueueMessage(Handler.java:643)
    at android.os.Handler.sendMessageAtTime(Handler.java:612)
    at android.os.Handler.sendMessageDelayed(Handler.java:582)
    at android.os.Handler.sendMessage(Handler.java:519)
    at android.os.Message.sendToTarget(Message.java:416)
    at com.google.android.exoplayer2.ExoPlayerImplInternal.prepare(ExoPlayerImplInternal.java:206)
    at com.google.android.exoplayer2.ExoPlayerImpl.prepare(ExoPlayerImpl.java:148)
    at com.google.android.exoplayer2.ExoPlayerImpl.prepare(ExoPlayerImpl.java:124)
    at com.devbrackets.android.exomedia.core.exoplayer.ExoMediaPlayer.prepare(ExoMediaPlayer.java:361)
    at com.devbrackets.android.exomedia.core.exoplayer.ExoMediaPlayer.setMediaSource(ExoMediaPlayer.java:222)
    at com.devbrackets.android.exomedia.core.exoplayer.ExoMediaPlayer.setUri(ExoMediaPlayer.java:215)
    at com.devbrackets.android.exomedia.core.audio.ExoAudioPlayer.setDataSource(ExoAudioPlayer.java:82)
    at com.devbrackets.android.exomedia.core.audio.ExoAudioPlayer.setDataSource(ExoAudioPlayer.java:69)
    at com.devbrackets.android.exomedia.AudioPlayer.setDataSource(AudioPlayer.java:119)
    at com.devbrackets.android.playlistcoredemo.helper.AudioApi.playItem(AudioApi.java:89)
    at com.devbrackets.android.playlistcoredemo.helper.AudioApi.playItem(AudioApi.java:17)
    at com.devbrackets.android.playlistcore.components.playlisthandler.DefaultPlaylistHandler.play(DefaultPlaylistHandler.kt:379)
    at com.devbrackets.android.playlistcore.components.playlisthandler.DefaultPlaylistHandler.startItemPlayback(DefaultPlaylistHandler.kt:338)
    at com.devbrackets.android.playlistcore.service.BasePlaylistService.handleRemoteAction(BasePlaylistService.kt:154)
    at com.devbrackets.android.playlistcore.service.BasePlaylistService.onStartCommand(BasePlaylistService.kt:133)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3327)
    at android.app.ActivityThread.-wrap21(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1583)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6121)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

multiple playlist listeners

I have to fragments for controlling media items. The first one has a recyclerview for showing playlist and the second one includes media playback buttons.
The problem is that when I attach both of them to playlist manager, only one of them will be notified on playlist item change. The first one. What should I do?

how to play local music file?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.0.1
  • Device OS version: 6.0
  • Devide Manufacturer: Huawei
  • Device Name: Nexus 6P
Reproduction Steps
Expected Result
Actual Result

Support Intent.ACTION_MEDIA_BUTTON broadcasts.

Hello! Some apps use this approach to control play\pause of media players.

for example:
val downIntent = Intent(Intent.ACTION_MEDIA_BUTTON)
val downEvent = KeyEvent(eventTime, eventTime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, 0)
downIntent.putExtra(Intent.EXTRA_KEY_EVENT, downEvent)
packageName?.let {
downIntent.setPackage(packageName)
}
context.sendBroadcast(downIntent)

    val upIntent = Intent(Intent.ACTION_MEDIA_BUTTON)
    val upEvent = KeyEvent(eventTime+50, eventTime+50, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, 0)
    upIntent.putExtra(Intent.EXTRA_KEY_EVENT, upEvent)
    packageName?.let {
        upIntent.setPackage(packageName)
    }
    context.sendBroadcast(upIntent)

or this question

https://stackoverflow.com/questions/40520094/android-unable-to-control-the-media-player-by-sending-the-broadcast-of-key-code

Can you please add support for this in your lib?

Fatal Exception: android.app.RemoteServiceException

  • PlaylistCore version: 2.0.0
  • Device OS version: 5.1
  • Devide Manufacturer: Huawei
  • Device Name: X2, P8 Lite
    Crash:
    Fatal Exception: android.app.RemoteServiceException
    Bad notification posted from package com.audio.app: Couldn't expand RemoteViews for: StatusBarNotification(pkg= com.audio.app user=UserHandle{0} id=2131230989 tag=null score=0 key=0|com.audio.app|2131230989|null|10133: Notification(pri=0 contentView= com.audio.app/0x109007f vibrate=null sound=null defaults=0x0 flags=0x72 color=0x00000000 category=transport actions=3 vis=PUBLIC))

Good afternoon! The application crashes when it is launched on some devices. I really hope for help from your side. Thank you for your work.

lack of pending intent notification

  • PlaylistCore version: 2.0.0
    Good afternoon!
    In the old version PlaylistCore 1.1.3 there was a simple setup pending intent notification , but now there is no.
    How it can be configured now?

Call invokePausePlay() while audio is on PREPARING state

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.1.1
  • Device OS version: 5.0.2
  • Devide Manufacturer: HTC
  • Device Name: One X
Reproduction Steps
  1. Start a playback from a remote file (url streaming)
  2. While file is in PREPARING state call invokePausePlay()
Expected Result

When the file exits PREPARING state right before invokePausePlay() was called, the media should start paused.

Actual Result

I get the following logs after calling invokePausePlay() while state is PREPARING:

D/onPlaybackStateChanged() called with: playbackState = [PREPARING]
D/MediaControlsHelper: update, controller is null ? false
D/PlaylistManager: Called invokePausePlay()
E/MediaPlayer: start called in state 4
E/MediaPlayer: error (-38, 0)
D/onPlaybackStateChanged() called with: playbackState = [PLAYING]
D/MediaControlsHelper: update, controller is null ? false
E/MediaPlayer: Error (-38,0)
D/PlaylistServiceCore: Retrying audio playback.  Retry count: 1
D/MediaPlayer: Couldn't open file on client side, trying server side
D/MainActivity: onPlaybackStateChanged() called with: playbackState = [PREPARING]
D/MediaControlsHelper: update, controller is null ? false
D/MediaService: performOnMediaCompletion() called 

Like the demo app, my performOnMediaCompletion() have this:

performNext();
immediatelyPause = false;

In my application when the user press the PLAY button on a stream file, the button instantly changes to a PAUSE button, even if the audio is still not playing, just preparing, and the user can hit the pause in this state.
In my case if the user does this, the performOnMediaCompletion() will be called and the next file in playlist will start playing, and I wanted the performOnMediaCompletion not to be called, but I think this is how Android MediaPlayer works if I call play while the file is being prepared, so searching a little more about this I've found that this method in PlaylistServiceCore.java,

protected void performPlayPause() {
    if (isPlaying()) {
        performPause();
    } else {
        performPlay();
    }
}

This method is triggered when I call invokePausePlay(), which checks if the audio is playing with the method MediaPlayer.isPlaying(), but the audio is in PREPARING state, so it will return false and the performPlay() will be called throwing these errors:

E/MediaPlayer: start called in state 4
E/MediaPlayer: error (-38, 0)

That's the reason onPlaybackStateChanged() is called with: playbackState = [PLAYING] right after performPlayPause()

I think something should be implemented in performPlayPause() to check if the audio is in PREPARING state and handles this case.

Seek position as "long"

  • I have verified there are no duplicate active or recent bugs, questions, or requests

Hi,

I've noticed that audio and video player except seek position as milliseconds (long), but performSeek() methods except position as int ;

It should be long too, right ?

I should be able submit PR to fix that.

Regards

Starting Youtube triggers unexpected behavior when ExoMedia is playing in the background

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 1.0.1
  • Device OS version: 6.0
  • Devide Manufacturer: LG
  • Device Name: Nexus 5
Reproduction Steps
  1. start the audio playback and put it into background.
  2. start the youtube app and play a video.
  3. the playback of ExoMedia has stopped. But the playback state in the notification bar still show a pause button.
  4. press the play/pause button two times, the audio will resume. And if you go to Youtube to play the video, you will hear both the audio from ExoMedia and Youtube.
Expected Result

for step 3, it should show a start button as the playback is stopped by Youtube.
for step 4, there should be only one audio being played. Either Youtube or ExoMedia.

onPrepared() called twice after invokeNext() or invokePrevious()

  • I have verified there are no duplicate active or recent bugs, questions, or requests

After calling invokeNext() or invokePrevious() on the manager, the onPrepared listener receives two "prepared" callbacks for audio playback. I'm using an AudioPlayerApi identical to the one in the demo with ExoPlayer as the backing audio player.

Expected Result:
Only one onPrepared() callback should occur.

Actual Result:
The first callback properly handles starting of the next audio item as expected, the second callback has the net effect of "pausing" the audio controls even though playback continues uninterrupted because of the if statement at the bottom of the startMediaPlayer() method that posts a PAUSED PlaybackState.

A quick question about PlaylistItemChange

Hi Brian, just for a quick question, the class PlaylistItemChange does not necessarily means that the item being played has been changed from one song to another song. It just represents the current item being played? I had assumed that 'PlaylistItemChange' means that the item being played has been changed from one song to another song after you put your app into background. Thank you very much for writing this library, it has greatly helped me in working a sample media play app.

Allow ability to retain audio focus when paused.

  • I have verified there are no duplicate active or recent bugs, questions, or requests

Currently when performPause() is called it also calls abandonAudioFocus(). This prevents the ability to pause instead of duck a transient focus loss because focus is never regained and playback cannot be continued.

Update buttons displayed at notifications section

When we have just one media item in our PlayListManager, the notification section displays just the play/pause button, that's ok, but how can we invoke to update the displayed buttons once we add a new media item to que queue list?? it there any way to do this?? for example to display the "Next" button when the new media item is added

-Using lib PlaylistCore version: 1.1.1

Where to show a dialog warning if I want to check for mobile or wifi internet

  • I have verified there are no duplicate active or recent bugs, questions, or requests

Hi I would like to allow media streaming only for wifi. In cases of mobile 3g internet, I would like to show a dialog box asking permission to allow to streaming using mobile data... Where should I put this mechanism

Thanks

is there a callback on the current audio playback completed

Hi there, just wondering if there is a callback on the current audio playback completed or not. I understand that there is a callback

`public interface ProgressListener {

/**
 * Occurs when the currently playing item has a progress change
 *
 * @return True if the progress update has been handled
 */
boolean onProgressUpdated(@NonNull MediaProgress mediaProgress);

}
`

But it does not necessarily means that the current playback is completed. And sometimes it will be invalid to check the logic of the equation between position and duration because it won't be exactly the same if you are using ExoPlayer.

Resume to play automatically when OnSeek is completed

In ExoMedia master demo, when we use the seekbar to drag the progress of a audio playback, it will first pause the playback and then start the seek. However, when the user stops tracking touch on the seek bar, it is supposed to resume the playback automatically. But in class

PlaylistServiceCore.java method

/**
     * Performs the functionality to end a seek for the current
     * media item.  This is called through an intent
     * with the {@link RemoteActions#ACTION_SEEK_ENDED}, through
     * {@link BasePlaylistManager#invokeSeekEnded(int)}
     */
    protected void performSeekEnded(int newPosition) {
        performSeek(newPosition);
    }

It did not resume to play the audio by executing the following statement.

if (pausedForSeek) { performPlay(); pausedForSeek = false; }

I am not sure this is by design or an issue. I will send the pull request in 10 minutes to fix it if it is considerate as an issue.

Disconnected from remote media player api when no other media player api is available causes unexpected behavior

  • I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
  • PlaylistCore version: 2.0.0
  • Device OS version: 8.1..0
  • Devide Manufacturer: Google
  • Device Name: Pixel 2 XL
Reproduction Steps
  1. Disconnect from a remote media player api while no other player api is available
Expected Result

The service should shut down as there is no way to play media.

Actual Result

Media playback stops, but the service is still running and the media notification is still visible, though none of the controls do anything.

Other Information

This appears to be happening because the updateCurrentMediaPlayer() method in the DefaultPlaylistHandler sets the currentMediaPlayer = null and then calls play(), which just returns false because the player is null.

It appears, though this was not my scenario, that the same thing would happen if I did have other players registered that can't handle playback of the item too.

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.