0
我試圖使用onVideoEnded()方法,但由於任何原因它不工作。Youtube API:監聽器onVideoEnded()不工作
我已經實現了PlayerStateChangeListener,但它似乎沒有工作。我已經爲每個實施方法添加了敬酒,他們並沒有開火。
當這個活動開始時,它會自動播放視頻:
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
player.loadVideo(videoId);
}
}
這是實現接口:
//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();
}
我這麼想嗎?
謝謝!