brianwernick / playlistcore Goto Github PK
View Code? Open in Web Editor NEWMedia Playlist Service With Notification and Remote View Support
License: Apache License 2.0
Media Playlist Service With Notification and Remote View Support
License: Apache License 2.0
1.1.1
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
Showing me UNKNOWN_ERROR which playing give URL.
Please check why this Audio not working.
1.0.1
6.0
Huawei
Nexus 6P
1.1.0
5.0.2
HTC
One X
playlistManager.play(0, false);
in AudioPlayerActivity.java to any value greater than 0, i.e.: playlistManager.play(10000, false);Start playing the audio exactly at the given seekPosition
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.
Good evening! I would like to pause a connection error, and not switch to another file. Thank you in advance.
Hello sir how to hide notification play button while music preparing this causes me to skip to next song when clicks on play button while preparing the song at first
and thank u sir for such good library
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.
1.1.1
5.0.2
HTC
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.
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.
3.0
6.0
LG
Nexus 5
playlistManager.play(0, false);
in AudioPlayerActivity.java
playlistManager.play(50 * 1000, false);
the loading progress bar disappears and plays the audio starting with 50 seconds.
the loading progress bar did not disappear but the audio starts with 50 seconds.
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.
2.0.0
The issue is reproducible in the project demo:
When the latest media in the playlist finishes it should change the playback state to stopped.
When the latest media in the playlist queue finishes the media is being played again.
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.
Good afternoon. How can I configure the support for the Bluetooth headset buttons? thank you in advance.
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
1.1.3
7.0
Motorola
Moto G4 Plus
1.1.1
6.0
Huawei
Nexus 6P
The notification doesn't follow the new android N styling. See Google Play Music for an example
1.1.1
6.0
HTC
One X
The audio replayed start on PREPARING state
The audio replayed is starting on PLAYING state, but it get stuck and nothing happens
1.1.3
5.0
xiaomi
@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...
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
1.0.1
6.0
Huawei
Nexus 6P
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;
}
});
}
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)
No crash expected
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)
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
playlistManager.setParameters() can add audio list,
But if i just add a audio to the playlist, What should I do?
And,How do I get a playlist?
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
Example:
performShuffle
performPrevious
performNext
performOnMediaCompletion
After call interruption, player goes to pause state. Is there a way to resume automatically?
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;
}
}`
1.0.1
7.1.2
Audio playback should start.
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)
In PlayListServiceCore.java After ACTION_PLAY_PAUSE intent handled , few seconds later onStartCommand with ACTION_STOP called - it closes notification and calls onPlaybackStateChanged (from PlaylistListener) with state STOPPED
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?
1.1.2
Commit 906ab1f causes the wrong audio position in the playlist to play. When trying to play position 0 it increments the position by one causing the next item in the list to start playback instead.
1.0.1
6.0
Huawei
Nexus 6P
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
Can you please add support for this in your lib?
2.0.0
5.1
Huawei
X2, P8 Lite
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.
2.0.0
1.1.1
5.0.2
HTC
One X
invokePausePlay()
When the file exits PREPARING state right before invokePausePlay()
was called, the media should start paused.
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.
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
1.0.1
6.0
LG
Nexus 5
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.
hi
am trying to download the playlistcore package but error
Error:(36, 13) Failed to resolve: com.devbrackets.android:playlistcore:1.0.0
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.
When release shuffle and random play feature. I hope, it will release soon with example.
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.
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.
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
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
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.
bro playlist core can support full screen lock screen control for player control bro?
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.
2.0.0
8.1..0
Google
Pixel 2 XL
The service should shut down as there is no way to play media.
Media playback stops, but the service is still running and the media notification is still visible, though none of the controls do anything.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.