diff --git a/README.md b/README.md index d089ee2..9b37233 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![logo](https://raw.githubusercontent.com/dev-labs-bg/fullscreen-video-view/master/logo.png) -========== +=== [![Download](https://api.bintray.com/packages/slavipetrov/maven/fullscreen-video-view/images/download.svg) ](https://bintray.com/slavipetrov/maven/fullscreen-video-view/_latestVersion) -[![Build Status](https://travis-ci.org/dev-labs-bg/fullscreen-video-view.svg?branch=0.0.9)](https://travis-ci.org/dev-labs-bg/fullscreen-video-view) +[![Build Status](https://travis-ci.org/dev-labs-bg/fullscreen-video-view.svg?branch=1.0.0)](https://travis-ci.org/dev-labs-bg/fullscreen-video-view) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/5d2c2572dd7b4a2fb5eeabd6c2e18fbc)](https://www.codacy.com/app/slavipetrov/fullscreen-video-view?utm_source=github.com&utm_medium=referral&utm_content=dev-labs-bg/fullscreen-video-view&utm_campaign=Badge_Grade) FullscreenVideoView is a custom VideoView Android library which makes loading, setting up and going fullscreen for video views easy. @@ -9,28 +9,27 @@ FullscreenVideoView is a custom VideoView Android library which makes loading, s Download -========== +=== You can use Gradle: ```gradle -compile 'bg.devlabs.fullscreenvideoview:library:0.0.9' +compile 'bg.devlabs.fullscreenvideoview:library:1.0.0' ``` or Maven: ```maven bg.devlabs.fullscreenvideoview library - 0.0.9 + 1.0.0 pom ``` How to use FullscreenVideoView? -========== +=== Declare the FullscreenVideoView in the XML layout file ```xml @@ -50,28 +49,28 @@ The Activity where the FullscreenVideoView is declared should handle configurati ``` Basic video loading (from URL or from a file) -```java +```kotlin // Loading from URL -@Override public void onCreate(Bundle savedInstanceState) { +override fun onCreate(savedInstanceState: Bundle?) { ... - FullscreenVideoView fullscreenVideoView = findViewById(R.id.fullscreenVideoView); - String videoUrl = "http://clips.vorwaerts-gmbh.de/VfE_html5.mp4"; - fullscreenVideoView.videoUrl(videoUrl); + val fullscreenVideoView = findViewById(R.id.fullscreenVideoView) + val videoUrl = "https://clips.vorwaerts-gmbh.de/VfE_html5.mp4" + fullscreenVideoView.videoUrl(videoUrl) } // Loading from file -@Override public void onCreate(Bundle savedInstanceState) { +override fun onCreate(savedInstanceState: Bundle?) { ... - FullscreenVideoView fullscreenVideoView = findViewById(R.id.fullscreenVideoView); - File videoFile = new File("file_path"); - fullscreenVideoView.videoFile(videoFile); + val fullscreenVideoView = findViewById(R.id.fullscreenVideoView) + val videoFile = new File("file_path") + fullscreenVideoView.videoFile(videoFile) } ``` Change controls drawable resources ----------- -Java -```java +--- +Java or Kotlin +```kotlin fullscreenVideoView.videoUrl(videoUrl) .playDrawable(R.drawable.ic_play) .pauseDrawable(R.drawable.ic_pause) @@ -96,39 +95,49 @@ XML ``` Enable/disable controls ----------- -```java +--- +```kotlin fullscreenVideoView.videoUrl(videoUrl) - .canPause(true) - .canSeekBackward(false) - .canSeekForward(false) + .disablePause() + .addSeekBackwardButton() + .addSeekForwardButton() ``` Enable video auto-start ----------- -```java +--- +```kotlin fullscreenVideoView.videoUrl(videoUrl) .enableAutoStart() ``` Customize fast-forward and/or rewind seconds ----------- -```java +--- +```kotlin fullscreenVideoView.videoUrl(videoUrl) .fastForwardSeconds(5) .rewindSeconds(5) ``` +Change the playback speed (only for API 23 and above) +--- +There are 7 playback speed values which are added by default, but they can be changed with custom ones when `playbackSpeedOptions` is used. +```kotlin +val playbackOptions = PlaybackSpeedOptions().addSpeeds(0.25f, 0.5f, 0.75f, 1f) + +fullscreenVideoView.videoUrl(videoUrl) + .addPlaybackSpeedButton() + .playbackSpeedOptions(playbackOptions) +``` Compatibility -========== +=== - Minimum Android SDK: API level 19 -- Compile Android SDK: API level 27 +- Compile Android SDK: API level 28 Known issues -========== +=== There is a memory leak in Android 7 (API levels 24 and 25), which is known and [listed](https://github.com/square/leakcanary/issues/721) in the LeakCanary repository issues. License -========== -Apache 2.0. See the [LICENSE](https://github.com/dev-labs-bg/fullscreen-video-view/blob/master/LICENSE.txt) file for details. +=== +Apache 2.0. See the [LICENSE](https://github.com/dev-labs-bg/fullscreen-video-view/blob/master/LICENSE.txt) file for details. \ No newline at end of file