To play video on layout background (textureview videoview for layout designs)

Overview

VideoLayout 🐔

🇨🇳 中文 🇰🇷 한국어 🇬🇧 English 🇹🇷 Türkçe

Codacy Badge License version Gitter

Preview

More stylish background designs

Performance friendly and scalable

Why this project exists

The normal videoview on Android is very costly in terms of performance. Also, due to the video resolution ratio and apk size, most developers don't want to include videos in the project. With this library, developers will have a performance-friendly video background with a few lines of code.

Features and Usage

Easy implementation

        frameLayout = findViewById(R.id.frameLayout)
        videoLayout = VideoLayout(this)
        videoLayout.setGravity(VideoLayout.VGravity.centerCrop)
        videoLayout.setIsLoop(true)
        videoLayout.setSound(true)
        videoLayout.setPathOrUrl("loginvideotype3.mp4") // could be any video url
        frameLayout.addView(videoLayout)
">
    <egolabsapps.basicodemine.videolayout.VideoLayout
            android:id="@+id/videoLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            app:sound="true"
            app:video_gravity="centerCrop"
            app:path_or_url="loginvideotype3.mp4"
            app:loop="true"/>
Recommended 💥
    override fun onDestroy() {
        super.onDestroy()
        videoLayout.onDestroyVideoLayout()
    }

    override fun onPause() {
        super.onPause()
        videoLayout.onPauseVideoLayout()
    }

    override fun onResume() {
        super.onResume()
        videoLayout.onResumeVideoLayout()
    }
You should put your mp4 files into assets folder, If you use URL you should declare
">
   <uses-permission android:name="android.permission.INTERNET"/>

Implementation Gradle

Add it in your root build.gradle at the end of repositories
    repositories {
        maven { url 'https://jitpack.io' }
    }
Add the dependency
    dependencies {
	    implementation 'com.github.AsynctaskCoffee:VideoLayout:1.3'
	}

Implementation Maven

Add the JitPack repository to your build file
    <repositories>
	    <repository>
	        <id>jitpack.io</id>
	        <url>https://jitpack.io
	    </repository>
    </repositories>
Add the dependency
    <dependency>
        <groupId>com.github.AsynctaskCoffeegroupId>
        <artifactId>VideoLayoutartifactId>
        <version>1.3</version>
    </dependency>

Updates

14.07.2020 - AndroidX migration und code refactor

21.09.2020 - Sound support and new preview design implementation added

02.12.2020 - Fix

License

   Copyright 2020 Egemen ÖZOGUL

   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.
   See the License for the specific language governing permissions and
   limitations under the License.
You might also like...
Noice is an android app that allows you to create your own set of background sounds by mixing clips from environmental sources.
Noice is an android app that allows you to create your own set of background sounds by mixing clips from environmental sources.

A native Android app to relax, improve focus and boost productivity with minimal background noise.

AudLibPlayer is a library that allows a client to play from a collection of public domain audiobooks hosted on a web service

AudLibPlayer is a library that allows a client to play from a collection of public domain audiobooks hosted on a web service

Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and more.
Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and more.

Blade Player Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and m

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 {

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

VideoPlayerView Custom Android view with video player, loader and placeholder image. To stay up-to-date with news about the library Usage Here is an e

On device extracting images from videos - creating video from images.

AndroidVideoTranscoder Surprisingly fast on device video transcoding. Features extracting images from video either ffmpeg or mediacodec creating video

Android Video Crop
Android Video Crop

🔺 Before using this library, read information below 🔺 This library is not more supported. If you want to add new feature or fix a bug, grab source

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

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

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

Comments
  • ERROR: Failed to resolve: com.github.AsynctaskCoffee:VideoLayout:1.0

    ERROR: Failed to resolve: com.github.AsynctaskCoffee:VideoLayout:1.0

    I added your library to gradle implementation 'com.github.AsynctaskCoffee:VideoLayout:1.0' and in build gradle buildscript { repositories { google() jcenter() maven { url 'https://jitpack.io' }

    }
    

    and got this error

    ERROR: Failed to resolve: com.github.AsynctaskCoffee:VideoLayout:1.0

    opened by emailsubjekt 21
  • Runtime Exception

    Runtime Exception

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.adhub.media.status.saver/com.adhub.media.status.saver.ui.activity.VideoViewerActivity}: android.view.InflateException: Binary XML file line #10 in com.adhub.media.status.saver:layout/activity_video_viewer: Binary XML file line #10 in com.adhub.media.status.saver:layout/activity_video_viewer: Error inflating class egolabsapps.basicodemine.videolayout.VideoLayout at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3488) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3635) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2175) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7857) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068) Caused by: android.view.InflateException: Binary XML file line #10 in com.adhub.media.status.saver:layout/activity_video_viewer: Binary XML file line #10 in com.adhub.media.status.saver:layout/activity_video_viewer: Error inflating class egolabsapps.basicodemine.videolayout.VideoLayout Caused by: android.view.InflateException: Binary XML file line #10 in com.adhub.media.status.saver:layout/activity_video_viewer: Error inflating class egolabsapps.basicodemine.videolayout.VideoLayout Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:854) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084) at android.view.LayoutInflater.inflate(LayoutInflater.java:682) at android.view.LayoutInflater.inflate(LayoutInflater.java:534) at android.view.LayoutInflater.inflate(LayoutInflater.java:481) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170) at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303) at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284) at com.adhub.media.status.saver.ui.activity.VideoViewerActivity.onCreate(VideoViewerActivity.kt:16) at android.app.Activity.performCreate(Activity.java:7955) at android.app.Activity.performCreate(Activity.java:7944) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3463) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3635) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2175) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7857) at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference at egolabsapps.basicodemine.videolayout.VideoLayout.(VideoLayout.java:87) ... 30 more

    opened by MadhubStudio 2
  • url format

    url format

    hi, i tried successfully to use your Layout with the file in assets... but when i try with URL, i obtain only a blank screen... in which format i have to provide the url? thank you

    opened by matteogabella 2
  • Video is not getting played on Android 11

    Video is not getting played on Android 11

    Video is not getting played on Android 11. I have tried in multiple phone with Android 11 but video is not getting played.

    Its working on android 10,12 and on other version of the operating system.

    What could be the solution for it, any alternate solution ?

    opened by vasuthakker 1
Releases(1.6)
Owner
Egemen ÖZOGUL
Mobile Application Engineer @donanimhaber @begosoft
Egemen ÖZOGUL
VideoView that plays video only when :eyes: are open and :boy: is detected with various other features

LookAtMe VideoView that plays video only when ?? are open and ?? is detected with various other features GIF AndroidPub (Medium) Post You can read the

Pradyuman Dixit 186 Dec 13, 2022
Android Texture VideoView having a variety of scale types like the scale types of ImageView such as fitCenter, centerCrop, centerTopCrop and more

Android-ScalableVideoView Looking for the extra scale types of ImageView? Check out ScalableImageView. Android Texture VideoView having a variety of s

Yoshihito Ikeda 1.1k Jan 7, 2023
Cache wrapper for standart android VideoView

Android VideoView cache Cache wrapper for standart android VideoView It uses okhttp and rxjava inside. Nothing special is needed to use. Setup: Add ma

Andrew0000 4 Aug 25, 2022
Radio Player - A Flutter plugin to play streaming audio content with background support and lock screen controls.

A Flutter plugin to play streaming audio content with background support and lock screen controls. Installation To use this package, add

Ayotunde abdulsalam 1 Mar 14, 2022
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.

Kishan Singh 6 Aug 14, 2022
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
Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer.

Yet Another Video Player Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer. Who Is YAVP For? First o

null 62 Dec 29, 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
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
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