MKVideoPlayer library is a video player have some basic features that need to develop an video player application in android studio
3AcFNxGKLW357XKg9RJuBPSU3wjezi1HPh
MKVideoPlayer library is a video player have some basic features that need to develop an video player application in android studio
The easiest way to get started using MKVideoPlayer(MK video player) is to add it as a gradle
dependency. You need to make sure you have the maven { url 'https://jitpack.io' } repositories
included in the build.gradle
file in the root of your project:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Next add a gradle compile dependency to the build.gradle
file of your app
module. The following will add a dependency to the full library:
dependencies {
compile 'com.github.khizar1556.MKVideoPlayer:mkvideoplayer:0.1.5'
}
just callMKPlayerActivity.configPlayer(activity).play(url)
.
<include
layout="@layout/mk_player"
android:layout_width="match_parent"
android:layout_height="match_parent" />
MKPlayer mkplayer = new MKPlayer(Activity);
mkplayer.play(url);
player.setPlayerCallbacks(new MKPlayer.playerCallbacks() {
@Override
public void onNextClick() {
//It is the method for next song.It is called when you pressed the next icon
//Do according to your requirement
}
@Override
public void onPreviousClick() {
//It is the method for previous song.It is called when you pressed the previous icon
//Do according to your requirement
}
});
play(url)
//play videostop()
//stop videopause()
//pause videostart()
//start videoforward()
// forward or back video,example: forward(0.1f) forward(-0.1f)getCurrentPosition()
setScaleType(MKPlayer.SCALETYPE_FITPARENT)
//set video scale typetoggleAspectRatio()
// toggle video scale typeseekTo(...)
//seek to specify positiongetDuration()
//get video durationonInfo(...)
//callback when have some informationonError(...)
//callback when an error occurredonComplete(...)
//callback when the play is overonControlPanelVisibilityChange(...)
//callback when control panel visibility changesetPlayerCallbacks()
//Callback to control next and previous methods