Play a Local Video File

Knowledge Base Entry: #44
^Top
<< Back
Mobile-Menu










Play a Local Video File
Category: Android/Snippets
Author: Bugfish
Created at: 2020-09-02 06:45:29
Modified at: 2025-09-20 01:49:41
Directs Hits: 706

Here the code to display a video in a videoView element.

VideoView videoview         =  findViewById(R.id.VIDEOVIEWID);
Uri uri = Uri.parse(STRING PATH TO FILE);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoview);

videoview.setMediaController(mediaController);
videoview.setVideoURI(uri);
videoview.start();
Caution: I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.
This Website is using Session Cookies for Site Functionality.