机器人:videoview历史/书签 [英] android: videoview history/bookmark

查看:135
本文介绍了机器人:videoview历史/书签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个录像机的应用。假设用户已经播放过的视频和播放视频的后半段,用户pressed后退按钮或存在该应用程序。我要记住位置,使得接下来的时间,用户播放相同的视频,视频的正是从它留给在同一个位置开始。

I have a videoplayer application. Suppose the user has played a video and after playing half of the video, the user pressed the back button or exists the application. I want that position to be remembered so that the next time, the user plays the same video, the video starts from exactly the same position from where it was left.

在这方面的任何想法?
谢谢了

Any ideas in this regard? Thanks much

推荐答案

首先,你需要将此数据存储在数据库中的一些,但它是非常简单的。

First, you will need to store this data in some database, but it's quite simple.

现在,你应该添加在你的活动的onPause()的onDestroy()方法检查,它得到从videoview位置:

Now, you should add a check in the onPause() or onDestroy() method of your activity, which gets the position from the videoview:

public void onPause() {
// ....
   int position = myVideoView.getCurrentPosition();
// store the position and file name (you should have it from before)
}

当你播放视频,设置当前位置之前存储的:

When you play a video, set the current position as stored before:

private void dummyPlayVideo(String fileName) {
// ....
    int position = getSavedPositionOfVideo(fileName); // your method
    myVideoView.seekTo(position);
}

这篇关于机器人:videoview历史/书签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆