GithubHelp home page GithubHelp logo

timbrueggenthies / leinwand Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 146 KB

A UI Component Library based on Jetpack Compose to play and control Video

License: Apache License 2.0

Kotlin 100.00%
android android-library compose jetpack-compose video video-player

leinwand's Introduction

Compose Video Player (WIP)

A UI Component Library that enables Video Playback and Control in your Compose UI. The components are build from the ground up with Compose, so the only usage of the view based system is the the SurfaceView to display the Video playback.

Usage

Add dependency

For now, the library is only published via Jitpack. Therefore, to use the library, you need to include the repository in your projects build.gradle(.kts) file.

allProjects {
  repositories {
    maven(url = "https://jitpack.io")  
  }
}

After that, you can add the dependency to the library

dependencies {
  implementation("com.github.timbrueggenthies.leinwand:core:<Version>")     // VideoPlayerState, can be used with completely custom UI
  implementation("com.github.timbrueggenthies.leinwand:ui-core:<Version>")  // Basic UI components, like a surface to play video
  implementation("com.github.timbrueggenthies.leinwand:ui:<Version>")       // Default UI components for video controls
}

Use Video Player

To use the UI components, you first need to create a VideoPlayerState which wraps the Player from the androidx.media library and provides many information, all backed the the Compose State interfaces.

setContent {
  val player = createOwnPlayer() // Cann be for example exoplayer filled with media items
  val playerState = rememberVideoPlayerState(player) { 
    // optional init block
  }
}

rememberVideoPlayerState creates the State object and binds the attributes to the Players event system.

Use default UI components

Compose Video Player comes with a limited set of default components that get you up and running fast. They are customizable in a small scope, but you are also free to create your own custom components very easily. You can use the VideoControlsContainer to get a good Scaffold for video player controls.

Only playback Video

If you don't need any video controls, you can use the VideoPlaybackSurface or VideoPlayback component, which allows you to display the content of a Player.

leinwand's People

Contributors

timbrueggenthies avatar

Stargazers

Robert Jakobs avatar Houssam Elbadissi avatar runo280 avatar Chetan Gupta avatar

Watchers

Robert Jakobs avatar  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.