Custom Android view with video player, loader and placeholder image

Overview

VideoPlayerView

Custom Android view with video player, loader and placeholder image.

Analytics Analytics

To stay up-to-date with news about the library Twitter URL

Usage

Here is an example flow:

Gif example

Here you can view all examples visible on gif.

When you use loop then video will be looping forever:

Img1

<com.marcinmoskala.videoplayview.VideoPlayView
    android:layout_width="match_parent"
    android:layout_height="200dp"
    app:loop="true"
    app:videoUrl="https://github.com/MarcinMoskala/VideoPlayView/raw/master/videos/cat1.mp4" />

You can set custom loader for the time when movie is downloaded from URL:

Img1

<com.marcinmoskala.videoplayview.VideoPlayView
    android:id="@+id/bigVideoView"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    app:videoUrl="https://github.com/MarcinMoskala/VideoPlayView/raw/master/videos/gdg.mp4" />

Static images can be set in xml, as loadingButton, but to display gif we need to use some library, like Glide:

VideoPlayView bigVideoView = findViewById(R.id.bigVideoView);
Glide.with(this)
        .load(R.drawable.loader)
        .into(bigVideoView.getLoadingView());

You can also show preview images. What is more, videos can be paused by user and preview image is shown then:

Img1

<com.marcinmoskala.videoplayview.VideoPlayView
    android:id="@+id/picassoVideoView"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    app:loop="true"
    app:videoUrl="https://github.com/MarcinMoskala/VideoPlayView/raw/master/videos/cat1.mp4" />

Image for loading and for pause can be defined in xml as image or it can be set programmatically. Then we can use libraries, like Picasso, to load it:

VideoPlayView videoView = findViewById(R.id.picassoVideoView);
Picasso.with(this).load("http://i.imgur.com/DvpvklR.png").into(videoView.getImageView());

Customization

VideoPlayerView properties are:

  • image - reference to preview image.
  • playButton - reference to play button image.
  • loadingButton - reference to loader image.
  • videoUrl - video url.
  • playButton - max vale of progress (100 by default).
  • loop - video will be replayed automatically when it is finished (false by default).
  • autoplay - video will be played automatically when it is loaded (false by default).

Installation

Just add in your module build.gradle following dependency:

dependencies {
    compile 'com.github.marcinmoskala:VideoPlayView:0.0.2'
}

Also add on your module build.gradle (unless you already have it):

repositories {
    maven { url 'https://jitpack.io' }
}

License

Copyright 2017 Marcin Moskała

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
You might also like...
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

ijkplayer Platform Build Status Android iOS Video player based on ffplay Download Android: Gradle # required allprojects { repositories {

api.video Android player
api.video Android player

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

 AutoPlayer - A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.
AutoPlayer - A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.

A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.

Exo Player Video with jetPack Compose
Exo Player Video with jetPack Compose

Exo Player Video with jetPack Compose

Sample HLS Video player in Kotlin with mvvm

HLSVideoPlayer Sample HLS Video player in Kotlin with mvvm Note: mvvm is partially implemented due to time constraint, so here is a scope for improvem

 Music Player - This is a basic music player built with Android Studio and Kotlin
Music Player - This is a basic music player built with Android Studio and Kotlin

Music Player Made by Jenny Cárdenas This is a basic music player built with Android Studio and Kotlin, it shows two views in the UI, the user can play

Odeon Music Player is a lightweight music player for Android.
Odeon Music Player is a lightweight music player for Android.

Odeon 🎵 Odeon Music Player is a lightweight music player for Android. Get it on Google Play. We value your privacy, your battery life and your device

Library for Instagram Image/Video Downloader for Android

Insta Downloader Simple Instagram Image Video Downloader Library for Android Implementation Step 1. Add the JitPack repository to your build file Add

Echo is a lightweight and minimal music player for Android, built with Android Studio and written in Kotlin
Echo is a lightweight and minimal music player for Android, built with Android Studio and written in Kotlin

Echo - Echo, A light-weight, minimal music player for Android, with shuffle, favorites and audio visualization

Comments
  • java.lang.IllegalArgumentException: state must be Initial

    java.lang.IllegalArgumentException: state must be Initial

    at com.marcinmoskala.videoplayview.VideoPlayView$$special$$inlined$observable$2.afterChange(Delegates.kt:58) at kotlin.properties.ObservableProperty.setValue(ObservableProperty.kt:36) at com.marcinmoskala.videoplayview.VideoPlayView.setVideoUrl(VideoPlayView.kt) at com.one.vipl.adapters.AdpFeeds.onBindViewHolder(AdpFeeds.java:156) at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6508) at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6541) at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5484) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5750) at android.support.v7.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:285) at android.support.v7.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:342) at android.support.v7.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:358) at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:365) at android.support.v7.widget.GapWorker.run(GapWorker.java:396) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6123) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

    opened by hiteshsarsava 5
Releases(0.0.5)
Owner
Marcin Moskała
Teacher, speaker, consultant, founder of Kot. Academy, author of Android Development with Kotlin.
Marcin Moskała
Compose-video-player - Video player for Android Compose powered by ExoPlayer

Compose Video Player Video player for Android Compose powered by ExoPlayer. Addi

Juan Pablo Herrera 22 Dec 13, 2022
Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface.

Fermata Media Player About Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface. It is focused on

Andrey 227 Jan 6, 2023
A Custom Video Player with Controls in Kotlin

UNT-Video-Player A Custom Video Player with Controls in Kotlin Hello folks, Here is the custom video player built in Kotlin; with SeekBar, fast forwar

ultroNeous Technologies 0 Nov 8, 2021
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀

Android p2p cdn sdk to distribute load and reduce costs(https://peervadoo.com) Vadootv is a p2p sdk integration to reduce your video streaming costs b

Vadootv 40 Oct 5, 2022
Simple and lightweight, yet polished and powerful Android video player based on ExoPlayer

Just (Video) Player Android video player based on ExoPlayer It uses ExoPlayer's extension-ffmpeg with all its audio formats enabled (it can handle eve

Marcel Dopita 677 Dec 28, 2022
Video Transcoder is an application which uses the open source program FFmpeg to transcode video files from one format to another.

Video Transcoder Do you want to encode videos on your phone into different formats, trim videos, or extract audio? Are you looking for a free solution

Branden Archer 358 Dec 30, 2022
The Madman library (Media Ads Manager) enables you to advertise video contents with video ads.

Madman (Media ads manager) is a high performance alternative to Google's standard IMA android SDK. If you have your own VAST server and want to render video ads and have full control over the UI, then this library is for you.

Flipkart Incubator 65 Nov 10, 2022
mpv-android is a video player for Android based on libmpv.

mpv-android is a video player for Android based on libmpv.

null 1.1k Jan 6, 2023
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

ijkplayer Platform Build Status Android iOS Video player based on ffplay Download Android: Gradle # required allprojects { repositories {

bilibili 31k Jan 3, 2023
NOVA is an open source video player for Android

NOVA: opeN sOurce Video plAyer Overview NOVA is an open source video player for Android. It consists in a fork of the original Archos Video Player Com

NOVA 876 Jan 2, 2023