VideoTimelineView - A TimelineView implementation for video cut and trim operation

Overview

VideoTimelineView

A TimelineView implementation for video cut and trim operation

Preview

#Usage

  1. Add the following line to you project level build.gradle file no need if already exist
allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

2.Add this to you app level build.gradle file

dependencies {
           implementation 'com.github.cse-ariful:VideoTimelineView:v.1.0.0'
   }

3.Add following to your xml file

  <com.ariful.mobile.timeline.TimelineView
       android:id="@+id/timeLineView"
       android:layout_width="match_parent"
       android:layout_height="60dp"
       android:layout_marginHorizontal="16dp"
       android:layout_marginTop="16dp"
       android:background="@drawable/rounded_corner_4dp" />
  1. Configure the view in java or kotlin class
  
        timeline = findViewById(R.id.timeLineView)
        timeline.setVideoUri(uri)
        
        //needed below line to properly pass the seek duration or if you dont set it you will get percent value
        //the seekMillis value will be icorrect in the callback
       
       timeline.setTotalDuration(player.duration)
        
        timeline.callback = object : TimelineView.Callback{
            override fun onSeek(position: Float, seekMillis: Long) {
                 
            }

            override fun onSeekStart(position: Float, seekMillis: Long) {
             }

            override fun onStopSeek(position: Float, seekMillis: Long) {
             }

            override fun onLeftProgress(leftPos: Float, seekMillis: Long) {
             }

            override fun onRightProgress(rightPos: Float, seekMillis: Long) {
             }
        }

#Optional

if you want to show the video play progress in timeline than you have to update the progress from player while playing for example if we are using exoplayer we can do the following

private fun initProgress() {
        player.addListener(object : Player.EventListener {
            override fun onPlayerError(error: ExoPlaybackException) {
                super.onPlayerError(error)
                mHandler.removeCallbacksAndMessages(null)
            }

            override fun onIsPlayingChanged(isPlaying: Boolean) {
                super.onIsPlayingChanged(isPlaying)
                if (isPlaying) {
                    mHandler.sendEmptyMessageDelayed(0, 16)
                } else {
                    mHandler.removeCallbacksAndMessages(null)
                }
            }

            override fun onPlaybackStateChanged(state: Int) {
                super.onPlaybackStateChanged(state)
                if (state == ExoPlayer.STATE_READY) { 
                    timeline.setTotalDuration(player.duration) 
                }
            }
        })
        mHandler = object : Handler(Looper.getMainLooper()) {
            override fun handleMessage(msg: Message) {
                super.handleMessage(msg)
                try {
                    val progress = (player.currentPosition.toFloat() / player.duration.toFloat())
                    timeline.setCurrentProgressValue(progress)
                    // updateProgressDependentComponent(progress)
                } catch (ex: Exception) {
                }
                if (player.isPlaying)
                    mHandler.sendEmptyMessageDelayed(0, 16)
            }
        }
        mHandler.sendEmptyMessage(0)
    }
    ```
 
You might also like...
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

A simple app showing how to make a YouTube Shorts/TikTok style video pager

It's pretty straightforward to get started using ExoPlayer by following the library's Hello world! documentation. Once you throw Android's lifecycles

An easy to use Instagram Video Downloader library for android apps.

Instagram-Video-Downloader-Library An easy to use library for directly download videos from ig reels, igtv. Implementation Step 1. Add the JitPack rep

Google's ML-Kit-Vision demo (android) for pre encoded video.
Google's ML-Kit-Vision demo (android) for pre encoded video.

Google's ML-Kit-Vision demo (android) for pre encoded video. Demos for camera preview and still image are also included. This project is actually extension of Google's own sample.

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

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.

A Custom Video Player with Controls in Kotlin
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

 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.

Releases(v1)
Owner
null
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
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
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
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

Marcin Moskała 89 Nov 18, 2022
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/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
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

null 29 Dec 20, 2022