Categories: ANDROID APP

How one can create your {custom} video participant App in Android?



This video exhibits the steps to create a video participant App in Android. It makes use of VideoView widget to show the video. Additionally, it makes use of Play, Pause, Cease and Restart operations button to do the fundamental operations of video participant.

We might be glad to listen to from you relating to any question, ideas or appreciations at: programmerworld1990@gmail.com

https://programmerworld.co/android/how-to-create-your-custom-video-player-app-in-android/
Supply code:

package deal com.instance.myvideoplayerapp;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import android.Manifest;
import android.content material.pm.PackageManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Atmosphere;
import android.view.View;
import android.widget.SeekBar;
import android.widget.VideoView;

public class MainActivity extends AppCompatActivity {

personal VideoView videoView;
personal SeekBar seekBar;
personal String MEDIA_PATH = Atmosphere.getExternalStorageDirectory().getPath() + “/Obtain/Sample_Videos2.mp4”;

@Override
protected void onCreate(Bundle savedInstanceState) {
tremendous.onCreate(savedInstanceState);
setContentView(R.format.activity_main);

ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, PackageManager.PERMISSION_GRANTED);

videoView = findViewById(R.id.videoView);
seekBar = findViewById(R.id.seekBar2);

videoView.setVideoPath(MEDIA_PATH);

videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
seekBar.setMax(videoView.getDuration());
}
});

}

public void PlayButton(View view){

if(videoView.isPlaying())
{
videoView.resume();
}
else{
videoView.begin();
}

new CountDownTimer(videoView.getDuration(),1){

@Override
public void onTick(lengthy l) {
seekBar.setProgress(videoView.getCurrentPosition(),true);
}

@Override
public void onFinish() {

}
}.begin();
}

public void PauseButton(View view){
videoView.pause();

}
public void RestartButton(View view){
videoView.stopPlayback();
videoView.setVideoPath(MEDIA_PATH);
videoView.begin();;

}
public void StopButton(View view){
videoView.stopPlayback();
videoView.setVideoPath(MEDIA_PATH);
}

}

source

linda

Recent Posts

Interactive Chat Games Inspired by Thrones

Have you ever found yourself wishing you could dive into the thrilling world of Westeros,…

2 days ago

Revive Your Memories: Free AI Photo Restoration

In this digital age, preserving memories has become more accessible than ever. However, many of…

5 days ago

Top Horrible Therapist Games to Try

In the ever-evolving landscape of party games, where humor and creativity collide, the "Horrible Therapist"…

5 days ago

How Visors Enhance Player Safety in Football

Football visors are transparent or tinted shields attached to the helmet's face mask. They're primarily…

2 weeks ago

Timeless Wonders Await: Exploring Beijing’s Rich Heritage on Your Trip

Introduction to Beijing Beijing, the capital of China, is a city that beautifully intertwines the…

2 weeks ago

Bangla NewsPaper Surge: 15 Game-Changing Strategies

Introduction to Bangla Newspaper Industry The Bangla newspaper sector has witnessed an incredible transformation over…

3 weeks ago