i'm trying to use the onVideoEnded() method, but by any reason it is not working.
I've implemented PlayerStateChangeListener but it did not seems to be working. I've added toasts on every method of the implementation, they are not firing.
when this activity starts, it automatically plays the video:
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
player.loadVideo(videoId);
}
}
And this is the interface implementation:
//start interface implementation
@Override
public void onLoading() {
android.widget.Toast.makeText(getApplicationContext(), "onloading",
android.widget.Toast.LENGTH_LONG).show();
}
@Override
public void onLoaded(String s) {
android.widget.Toast.makeText(getApplicationContext(), "onloaded",
android.widget.Toast.LENGTH_LONG).show();
}
@Override
public void onAdStarted() {
android.widget.Toast.makeText(getApplicationContext(), "onadstarted",
android.widget.Toast.LENGTH_LONG).show();
}
@Override
public void onVideoStarted() {
android.widget.Toast.makeText(getApplicationContext(), "onvideostarted",
android.widget.Toast.LENGTH_LONG).show();
}
@Override
public void onVideoEnded() {
android.widget.Toast.makeText(getApplicationContext(), "onvideoended",
android.widget.Toast.LENGTH_LONG).show();
}
@Override
public void onError(YouTubePlayer.ErrorReason errorReason) {
android.widget.Toast.makeText(getApplicationContext(), "onerror",
android.widget.Toast.LENGTH_LONG).show();
}
Am i missing something?
thanks!