How to run videos on android

Asked

Viewed 69 times

-2

I want to run a background video as a Standby screen, hiding player controls etc.

1 answer

1


Good evening, Android offers a wide API for running medias, the easiest way for you to run videos is by using Videoview which is a wrapper of Mediaplayer and Surfaceview.

Simple example, add the Videoview element in xml layout and Java code:

    VideoView videoView = (VideoView) 
                        findViewById(R.id.videoView);

    videoView.setVideoPath(
             "uri da mídia");

    MediaController mediaController = new 
        MediaController(this);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);
    videoView.start();      

Browser other questions tagged

You are not signed in. Login or sign up in order to post.