Skip to content

Latest commit

 

History

History
104 lines (80 loc) · 3.64 KB

README.md

File metadata and controls

104 lines (80 loc) · 3.64 KB

Maven Central

ExoMedia

ExoMedia is an audio/video playback library for Android built on top of the ExoPlayer with straightforward APIs and integrations. This library focuses on quick setup, handling common audio and video playback needs while also providing extensibility for more custom use cases.

ExoMedia vs ExoPlayer

The ExoPlayer is an advanced media player for Android that is highly customizable, however that comes at the cost of a more complex setup and configuration process. This customizability is great when it's needed however can be daunting when you need to play a simple audio or video file.

ExoMedia is a more high-level abstraction of media playback that abstracts some of the customizability provided by the ExoPlayer into simple functions and callbacks, keeping the required configuration to a minimum.

Use

The latest version can be found at Maven Central.

repositories {
  mavenCentral()
}

dependencies {
  implementation 'com.devbrackets.android:exomedia:5.1.0'
}

Quick Start

The ExoMedia VideoView can be added in your layout files like any other Android view.

<RelativeLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

	<com.devbrackets.android.exomedia.ui.widget.VideoView
		android:id="@+id/video_view"
		android:layout_width="match_parent"
		android:layout_height="match_parent" />
</RelativeLayout>

While in your Activity or Fragment you treat it like a standard Android VideoView

private lateinit var videoView: VideoView

private fun setupVideoView() {
  // Make sure to use the correct VideoView import
  videoView = findViewById(R.id.video_view) as VideoView
  videoView.setOnPreparedListener(this)

  // For now we just picked an arbitrary item to play
  videoView.setMedia(Uri.parse("https://www.devbrackets.com/media/samples/video/big_buck_bunny.mp4"))
}

@Override
fun onPrepared() {
  //Starts the video playback as soon as it is ready
  videoView.start()
}

License

Copyright 2015-2023 ExoMedia Contributors

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.

Attribution