📌  相关文章
📜  Correction de faute de codeage en ligne - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:30.234000             🧑  作者: Mango

代码示例1
class MainActivity2 : AppCompatActivity() {

    var videoView: VideoView? = null

    var mediaController: MediaController? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main2)

        (findViewById(R.id.videoView) as VideoView?).also { videoView = it }

        if (mediaController== null) {
            val context = null
            mediaController= context?.let { mediaController(it this) }
            mediaController!!.setAnchorView(this.videoView)
    }
        videoView!!.setMediaController(mediaController)
        val uriString = "android.resource://+packageName+ "/" +R.raw.bts"
        videoView!!.setVideoURI(Uri.parse(uriString))

        videoView!!.requestFocus()


        videoView!!.start()

        videoView!!.setOnCompletionListener { it MediaPlayer!


        }
}