-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icecast and Shoutcast metadata detect [Android] #384
Conversation
|
||
public IcyMetadataListener onIcyMetadaUpdate(){ | ||
return manager.onIcyMetadaUpdate(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally unnecessary method here, you can call the MusicManager directly instead of going through the player
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I read the code, I ended up reading wrong and noticed that the MusicManager manager
in ExoPlayback.java
was set to private
. But reading again I noticed that it is defined as protected
, so the LocalPlayback
class has access to it.
To 'delete' this function, I will have to change the scope of toMediaSource
.
From:
public MediaSource toMediaSource (Context ctx, LocalPlayback playback) {
...
}
To:
public MediaSource toMediaSource (Context ctx, LocalPlayback playback, MusicManager manager) {
...
}
Changing also the LocalPlayBack.java
file on lines 73 and 83 to:
Linha 73:
source.addMediaSource(index, track.toMediaSource(context, this, manager), Utils.toRunnable(promise));
Linha 83:
trackList.add(track.toMediaSource(context, this, manager));
Thanks, that's a huge improvement! There are still a few things not quite right, but I'll help you with those tomorrow. What I mean is that you can use the same event for both the metadata and the header, I'll show you tomorrow how that should work. |
I totally agree with you, the code is actually cleaner and readable. About Header, I understood perfectly how to use the same event for both types. It would basically add a |
@@ -59,6 +60,16 @@ public void onReceive(Context context, Intent intent) { | |||
|
|||
private boolean stopWithApp = false; | |||
|
|||
private IcyMetadataListener icyMetadaUpdate = new IcyMetadataListener() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should straight up crash if you didn't enabled the icy extension.
Here are the major changes I did:
I didn't tested this yet. Due to this being a pretty specific feature, this might be moved to an "addon module" in the future, we'll see how it goes. We should look into saschpe/android-exoplayer2-ext-icy#2 before merging this. |
I'll test here now, and I'll give you feedback. On the problem of metadata arriving before the audio, I have this same problem, but I made a correction in JS. What happens is, this type of metadata update check checks the data that has arrived from the network. The correct would be to check the data before going to the decoder of the audio, because there is a radio (same as mine) that has a predefined buffer of X seconds, the verification via Network does not take into account this Buffer, while checking before the decoder would take into consideration. Note: Do you want me to start putting the message in Portuguese after the English text? |
During my test it was possible to detect the error That's exactly what you said, when the I do not know if the way I did the fix was the best, but so the error stopped. Maybe it will take a while for me to get used to the "writing mode" of this project, so I'll beg to apologize. |
We finally merged #465, but I think I'll be holding this PR a little longer. The developer from the icy extension pushed a PR to ExoPlayer (google/ExoPlayer#4993), which has been approved and it's currently on their dev branch. Once it's released, we can move to a new, clean solution, that also supports ID3, SCTE35 and EMSG metadata, and no new extensions will be required. |
Closed / Discontinued. |
Closed / Discontinued.
Replaced with #552 (Best Performance).
Metadata detection was implemented, using the code created by @saschpe (android-exoplayer2-ext-icy or ExoPlayer), where it performs HTTP detection for ExoPlayer.
The
icy-update
event that is called when the meta-date is updated.Two attributes are sent in this event:
The
icy-header
event was disregarded for this implementation because it was taken into account that it is not "necessary" to use the same event.The type
ICY
audio was added because the operation with the HLS is possible, but through the @saschpe code the same does not work, because in HLS the sending of the metadata is not at the beginning of the data received obligatorily.To update the notification, it is recommended to use the code implemented by @HybridFox (#331). Because the direct updating of the information would not be a good thing, because the person can obtain information from the metadata and make a query in an api and with the result obtained to update the notification.
If you want to test, you can use this Track for testing: