如何在YouTube之类的视频中跳回一秒钟?

时间:2019-03-24 09:49:57

标签: android android-videoview

我制作了一个基于视频的游戏。视频从一半播放。按下按钮时,视频需要向后跳一秒钟。问题是实际上它跳到了特定点。我该如何解决?

    /// ----------------------------------------------------------------------------------------
    public void onFlower(View view) {
            VideoView myVideo = (VideoView) findViewById(R.id.videoView);
            myVideo.seekTo(myVideo.getCurrentPosition() - 1000);
    }

    /// ----------------------------------------------------------------------------------------
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        /// ------------------------------------------------------------------------------------
        setContentView(R.layout.activity_play);
        ///locking the screen on portrait
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        ///locking the screen on portrait
        boolean bool1 = false;
        /// ------------------------------------------------------------------------------------
        VideoView myVideo = (VideoView) findViewById(R.id.videoView);
        myVideo.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.degreesvideo);
        myVideo.seekTo(26000);
        myVideo.start();

    }
}

0 个答案:

没有答案