检测 youtube 视频何时在 Android 中播放完毕 [英] Detecting when a youtube video finishes in Android
本文介绍了检测 youtube 视频何时在 Android 中播放完毕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 youtube api 在 android 中制作应用程序.该应用程序显示了一个 youtube 视频,然后我想在用户观看视频后提出有关该视频的问题.我想知道谁能检测到视频的结尾,以便通过一个问题开始一项活动.提前致谢.
I´m making in app in android using youtube api. The app shows a youtube video and then I want to do a question about the video after the user watches it. I would like to know who can I detect the end of the video in order to start one activity with a question. Thanks in advance.
推荐答案
如果您使用的是 youtube API,您可以在视频播放完成时收到回调.因此,通过覆盖以下内容,您可以实现您的代码,
You can get a callback when video has completed if you are using the youtube API. So by ovveriding the following you can implement your code,
@Override
public void onVideoEnded() {
//Put your code here
}
这篇关于检测 youtube 视频何时在 Android 中播放完毕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文