Giter Site home page Giter Site logo

drahonn / fullscreen-video-view Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dev-labs-bg/fullscreen-video-view

0.0 1.0 0.0 12.35 MB

Home Page: https://notes.devlabs.bg/fullscreenvideoview-videoview-gone-fullscreen-daa5fd8181d8

License: Apache License 2.0

Java 100.00%

fullscreen-video-view's Introduction

logo

Download Build Status Codacy Badge

FullscreenVideoView is a custom VideoView Android library which makes loading, setting up and going fullscreen for video views easy.

Download

You can use Gradle:

compile 'bg.devlabs.fullscreenvideoview:library:1.0.0'

or Maven:

<dependency>
  <groupId>bg.devlabs.fullscreenvideoview</groupId>
  <artifactId>library</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

How to use FullscreenVideoView?

Declare the FullscreenVideoView in the XML layout file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <bg.devlabs.fullscreenvideoview.FullscreenVideoView
        android:id="@+id/fullscreenVideoView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

The Activity where the FullscreenVideoView is declared should handle configuration changes, which imposes this change in the AndroidManifest.xml file

<activity
    android:name="your_activity_name"
    android:configChanges="orientation|screenSize" />

Basic video loading (from URL or from a file)

// Loading from URL
override fun onCreate(savedInstanceState: Bundle?) {
	...
	val fullscreenVideoView = findViewById(R.id.fullscreenVideoView)
	val videoUrl = "https://clips.vorwaerts-gmbh.de/VfE_html5.mp4"
	fullscreenVideoView.videoUrl(videoUrl)
}

// Loading from file
override fun onCreate(savedInstanceState: Bundle?) {
	...
	val fullscreenVideoView = findViewById(R.id.fullscreenVideoView)
	val videoFile = new File("file_path")
	fullscreenVideoView.videoFile(videoFile)
}

Change controls drawable resources

Java or Kotlin

fullscreenVideoView.videoUrl(videoUrl)
        .playDrawable(R.drawable.ic_play)
        .pauseDrawable(R.drawable.ic_pause)
        .fastForwardDrawable(R.drawable.ic_fast_forward)
        .rewindDrawable(R.drawable.ic_rewind)
        .enterFullscreenDrawable(R.drawable.ic_fullscreen)
        .exitFullscreenDrawable(R.drawable.ic_fullscreen_exit)

XML

<bg.devlabs.fullscreenvideoview.FullscreenVideoView
        android:id="@+id/fullscreenVideoView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:play_drawable="@drawable/ic_play"
        app:pause_drawable="@drawable/ic_pause"
        app:ffwd_drawable="@drawable/ic_fast_forward"
        app:rew_drawable="@drawable/ic_rewind"
        app:enter_fullscreen_drawable="@drawable/ic_fullscreen"
        app:exit_fullscreen_drawable="@drawable/ic_fullscreen_exit"/>

Enable/disable controls

fullscreenVideoView.videoUrl(videoUrl)
        .disablePause()
        .addSeekBackwardButton()
        .addSeekForwardButton()

Enable video auto-start

fullscreenVideoView.videoUrl(videoUrl)
        .enableAutoStart()

Customize fast-forward and/or rewind seconds

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.

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 28

Known issues

There is a memory leak in Android 7 (API levels 24 and 25), which is known and listed in the LeakCanary repository issues.

License

Apache 2.0. See the LICENSE file for details.

fullscreen-video-view's People

Contributors

slavipetrov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.