I made a fragment with following code:
class play_video : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_play_video)
val vidView = findViewById<VideoView>(R.id.videoView)
val vidController = MediaController(this)
val viduri = Uri.parse("android.resource://"+packageName+"/"+R.raw.test1)
vidView.setVideoURI(viduri)
vidView.start()
}
}
It shows the first frame of video and plays sound, but the video was not played and it only shows stopped image.
Is there anything I did wrong ?
The file name of the movie file is 'test1.MOV'
The format .MOV
is not supported.
Check https://developer.android.com/guide/topics/media/media-formats
I suggest to convert your video with one supported. If you don't know how to convert a video use ffmpeg
https://ffmpeg.org/