Load And Play Video From URL In VideoView Android Studio

Hello, coders. In this load and play video from URL android studio tutorial example, we will learn to play or load video from URL or server.

You can load video from URL in android Videoview programmatically.

First, check the output of this load and play video from URL Android and then we will implement it step by step.

Wait for one minute

Here, we will load or play video from URL. If you wish to load video from Android studio’s raw directory, then check here: Videoview android studio example tutorial.

Download Source Code for load and play video from url android

[sociallocker] Download Demo [/sociallocker]

Try Cake Application

Wish your dear ones happy birthday with special birthday cake which contains his/her name and photo on cake.

Visit app here : Photo and Name on Birthday Cake

Step 1: Create a new project in the android studio.

Step 2: Updating AndroidManifest.xml file

add internet permission between <manifest>….</manifest> tag.

Note: If you are targeting SDK version above 22 (Above Lollipop)  then you need to ask a user for granting runtime permissions. Check marshmallow runtime permission for more information.

Step 3: Updating activity_main.xml file

Add below code in activity_main.xml file

Step 4: Updating MainActivity.java class :

Add below code to MainActivity.java

Step 5: Description of MainActivity.java

  • Below code
  • will set mediacontrollers(previous, pause, play, next buttons) to videoview.
  • Below code
  • Here you need to update your server URL to the video.

  • As you can see we are using boolean isContinuously to detect which button is pressed, Either “ONCE” or “Continuously .
  • We are managing isContinuously and starting a video on both button’s click method as below.

We will remove progressBar when a video is prepared to run. See below code

Kotlin Version

Kotlin Version : Android Kotlin Play Video From URL 

So all for this play video url android studio example tutorial.

If you have any query regarding this tutorial, then ask in the comment section.

Thank you for your time, keep visiting for more tutorials.

Hardik Parsania

I am mobile app developer. I am always passionate about solving complex and real world problems.I have developed many apps with great interest and superior logical skills.

You may also like...

4 Responses

  1. www.linkedin.com says:

    Having read this I believed it was extremely enlightening.

    I aporeciate you spending some time and energy to put this information together.

    I once again find myself personally spending way too
    much time both reading and commenting. But so what, it was
    still worthwhile!

  2. vijay says:

    Hi Hardik Parsania,

    My name is Vijay, i developed an Digital Signage application using Android studio in which i has to play video and image sliding in one activity.As apart of cloud integration am using amazon s3 cloud i want some help regarding how to download videos and images dynamically from amazon cloud to external storage. please help me regarding this.

  3. Hubert says:

    Please what if I want to load video from my firebase database into a recyclerview

Leave a Reply

Your email address will not be published. Required fields are marked *