VideoView SeekTo working abnormally on different devices - Android

て烟熏妆下的殇ゞ 提交于 2019-12-07 18:14:40

问题


I am using this code on video view to seek to custom position but it is working fine on samsung devices but on sony devices the video seeks to the start position(beginning)

I want to get video to the position where it was last time paused

Creating Video View:

        VideoView mVideoPlayer.setVideoPath(ViDpath);

        MediaController mCd = new MediaController(this);
        mVideoPlayer.setMediaController(mCd);
        mVideoPlayer.requestFocus();

Pause and Play works fine:

        mVideoPlayer.pause();
        mVideoPlayer.start();

This works abnormally:

        mVideoPlayer.seekTo(anyCustomPosition);

Testing:
I tested it further on different devices.

  • Moto X 2014 Lollipop: It works abnormally, sometimes video continues and sometimes it starts over.
  • Samsung S4 KitKat: Works better but dont seeks to the exact position.
  • Sony Xperia Z KitKat: Video always starts over(from the beginning).

Is there any alternate?
Or a way to fix it?

来源:https://stackoverflow.com/questions/29251368/videoview-seekto-working-abnormally-on-different-devices-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!