-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
IPlayerEventListener on android #79
Comments
Same issue. |
Implement the interface and optionally act on the events. Here's ours: public void OnLoadingChanged(bool isLoading)
{
Console.WriteLine("Loading changed");
}
public void OnPlaybackParametersChanged(PlaybackParameters p0)
{
this._mediaPlayer.PlaybackParameters = p0;
}
public void OnPlayerError(ExoPlaybackException ex)
{
this.OnMediaFileFailed(new MediaFileFailedEventArgs(ex, this.CurrentFile));
}
private DateTimeOffset LastEnded { get; set; }
private Guid testGuid { get; set; }
public void OnPlayerStateChanged(bool playWhenReady, int state)
{
this.testGuid = Guid.NewGuid();
if (state == Player.StateEnded)
{
if (this.LastEnded.AddSeconds(3) < DateTimeOffset.Now)
{
this.LastEnded = DateTimeOffset.Now;
this.OnMediaFinished(new MediaFinishedEventArgs(this.CurrentFile));
}
}
else if (state == Player.StateBuffering)
{
var status = this.GetStatusByIntValue(state);
var compatState = this.GetCompatValueByStatus(status);
this.SessionManager.UpdatePlaybackState(compatState, this.Position.Seconds);
this.CheckStuck(state, this.testGuid);
}
else
{
var status = this.GetStatusByIntValue(state);
var compatState = this.GetCompatValueByStatus(status);
this.SessionManager.UpdatePlaybackState(compatState, this.Position.Seconds);
}
}
public void OnPositionDiscontinuity(int p0)
{
}
public void OnRepeatModeChanged(int p0)
{
}
public void OnSeekProcessed()
{
}
public void OnShuffleModeEnabledChanged(bool p0)
{
}
public void OnTimelineChanged(Timeline p0, Object p1, int p2)
{
}
public void OnTracksChanged(TrackGroupArray p0, TrackSelectionArray p1)
{
} |
My code is like:
@thomashagstrom Which gives the following error:
|
@marufbd would need a bit more of the stacktrace. What's the actual error? Missing, null reference etc? |
@thomashagstrom whole of stacktrace:
|
I think Player.EventListener has got default methods which Xamarin.Binding does not support yet |
Does anybody find a way to use the event listener ? When I create the methods, they are never called. |
You need to set the dex compiler to d8 in the android options so java 1.8 support is enabled. |
@martijn00 I have set the d8 dex compiler, but events from IPlayerEventListener are not firing anyway. Why did you close issue? |
For me the app builds and the exoplayer is working as intended (with the last version and with d8 enabled). But the event listener is never triggered. The interface seem empty, there is no methods in it so the events are not triggered. |
1 similar comment
For me the app builds and the exoplayer is working as intended (with the last version and with d8 enabled). But the event listener is never triggered. The interface seem empty, there is no methods in it so the events are not triggered. |
Actually, there is no way to override |
Actually you can, but you have to implement every single method from IPlayerEventListener interface, for some reason default implementation causes |
💬 Questions and Help
Hello. how possible implement IPlayerEventListener on android?
on official documentation http://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/Player.EventListener.html it's contains many methods, but I don't see it on xamarin. Also in your simple https://github.com/martijn00/ExoPlayerXamarin/blob/4a5110d2695663be138150df43fbbeeb644331c1/Samples/Main/PlayerActivity.cs I see commented code too
The text was updated successfully, but these errors were encountered: