Skip to content

danbeldev/exo-player-compose

Repository files navigation

ExoPlayerCompose

Platform API

Gradle

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    implementation 'com.github.Danila009:exo-player-compose:0.2.0'
}

Manifest

    <uses-permission android:name="android.permission.INTERNET"/>

ExoPlayer

val exoParameters = exoParameters {
    url = VIDEO_URL
    useController = false
    statePlayPause = VideoPlayerPausePlayState.PAUSE
}
ExoPlayer(
    parameters = exoParameters
)

Exo Player Custom Controller

val exoPlayer = exoPlayer {
    setMediaItem(MediaItem.fromUri(VIDEO_URL))
    prepare()
    play()
}
ExoPlayerCustomController(
    styledPlayerView = {
        player = exoPlayer

        this.useController = true
    }
) {
    Text(text = "Test")
}

Custom ExoPlayer (video item)

val exoParameters = exoCustomParameters {

    useController = true

    onProgressBarVisibility = {
        Log.d("onProgressBarVisibility",it.toString())
    }

    onVideoListPositionItem = {
        Log.d("onVideoListPositionItem",it.toString())
    }

    onFullscreen = {
        Log.d("onFullscreen",it.toString())
    }
}
ExoPlayerCustom(
    modifier = Modifier
        .fillMaxWidth()
        .height(300.dp),
    url = VIDEO_URL,
    parameters = exoParameters
)

Custom ExoPlayer (video list)

ExoPlayerCustom(
    modifier = Modifier
        .fillMaxWidth()
        .height(300.dp),
    videoList = videoList,
    parameters = exoParameters
)

You Tube Double Tap

Documentation

val exoParameters = exoCustomParameters {
    
    
    doubleTapParameters = doubleTapParameters {
        enabled = true

        seekSeconds = 10

        animationDuration = 650
    }
    
}

Preview Seek Bar

Documentation

val exoParameters = exoCustomParameters {

    previewSeekBarParameters = previewSeekBarParameters {
        enabled = true
        previewUrl = "https://bitdash-a.akamaihd.net/content/MI201109210084_1/thumbnails/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.jpg"
    }
    
}

Video Filters

Documentation

val exoParameters = exoCustomParameters {

    exoFilterParameters = exoFilterParameters {
        type = ExoFilterType.INVERT
    }
    
}

License

Copyright (C) 2022 Danila Belyakov dan.nel.89@bk.ru


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.