Seamless video Loop with VideoView

前端 未结 8 1978
春和景丽
春和景丽 2021-01-30 12:03

I have the following code to take a video as a raw resource, start the video and loop it but I need the video to loop seamlessly as of now when it comes to an end of the clip an

8条回答
  •  借酒劲吻你
    2021-01-30 12:53

    If you are using Kotlin

     videoView.setOnPreparedListener(object : MediaPlayer.OnPreparedListener {
                    override fun onPrepared(mp: MediaPlayer?) {
                        //Start Playback
                        videoView.start()
                        //Loop Video
                        mp!!.isLooping = true;
                        Log.i(TAG, "Video Started");
                    }
                });
    

    Using Arrow Expression short form

    videoView.setOnPreparedListener { mp ->
                //Start Playback
                videoView.start()
                //Loop Video
                mp!!.isLooping = true;
                Log.i(TAG, "Video Started");
            };
    

提交回复
热议问题