根据VideoView中的时间显示textview?
我想根据视频观看时间以一定的时间间隔依次显示文本。让我对此做一个简短的说明:假设我播放的视频时长为 20 秒。所以在这里我明智地以 5 秒、8 秒、15 秒的间隔显示文本视图(具有不同的文本)。第 20 秒时。整个文本视图将消失。 所以任何提示或任何可以帮助我解决这个问题的东西。 谢谢
I want to show text one after the other on certain interval of time depending on the time of videoview. Let me provide a brief note on this: Say the video that i play is of 20sec. So here I wise to display textview(with different text) on interval of 5sec, 8sec, 15sec. and at 20th sec. the whole textview will disappear.
So any hints or anything that may help me to fix this.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,没有方便的侦听器来报告进度。您可以使用一个
Handler
来根据您希望TextView
显示的时间对延迟的Message
进行排队(因此使用Handler .sendMessageDelayed
),当它们触发时,对 TextView 做正确的事情。如果视频暂停或延迟(可能是由于通过网络播放),您将需要采取额外的步骤来验证视频的位置是否正确,但这应该可行。Unfortunately there is no convenient listener that reports back the progress. You can possibly use a
Handler
that queues up delayedMessage
s based on the times you want theTextView
to show (so useHandler.sendMessageDelayed
) and as they fire do the right thing to the TextView. If the video gets paused or is delayed (perhaps from playing over the network) you will need to take additional steps to verify that the video's position is right, but that should work.