ExoPlayer
This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
Top Related Projects
VLC for Android, Android TV and ChromeOS
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
Android开源弹幕引擎·烈焰弹幕使 ~
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,16k page size,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
VAP是企鹅电竞开发,用于播放特效动画的实现方案。具有高压缩率、硬件解码等优点。同时支持 iOS,Android,Web 平台。
ncnn is a high-performance neural network inference framework optimized for the mobile platform
Quick Overview
ExoPlayer is an open-source media player library for Android developed by Google. It provides a flexible alternative to Android's MediaPlayer API, supporting advanced features like DASH and SmoothStreaming adaptive playbacks, custom renderers, and extensive customization options.
Pros
- Supports a wide range of audio and video formats, including adaptive streaming protocols
- Highly customizable and extensible architecture
- Regular updates and active community support
- Seamless integration with other Android components and libraries
Cons
- Steeper learning curve compared to the native MediaPlayer API
- Larger app size due to additional dependencies
- May require more setup and configuration for basic use cases
- Some advanced features might be overkill for simple media playback needs
Code Examples
- Basic video playback:
val player = ExoPlayer.Builder(context).build()
val mediaItem = MediaItem.fromUri("https://example.com/video.mp4")
player.setMediaItem(mediaItem)
player.prepare()
player.play()
- Creating a custom LoadControl:
class CustomLoadControl : DefaultLoadControl() {
override fun shouldContinueLoading(bufferedDurationUs: Long, playbackSpeed: Float): Boolean {
return bufferedDurationUs < 10 * C.MICROS_PER_SECOND
}
}
val player = ExoPlayer.Builder(context)
.setLoadControl(CustomLoadControl())
.build()
- Adding an analytics listener:
player.addAnalyticsListener(object : AnalyticsListener {
override fun onPlayerStateChanged(eventTime: AnalyticsListener.EventTime, playWhenReady: Boolean, playbackState: Int) {
when (playbackState) {
Player.STATE_READY -> Log.d("ExoPlayer", "Ready to play")
Player.STATE_ENDED -> Log.d("ExoPlayer", "Playback ended")
}
}
})
Getting Started
To use ExoPlayer in your Android project, add the following dependencies to your app's build.gradle
file:
dependencies {
implementation 'com.google.android.exoplayer:exoplayer-core:2.X.X'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.X.X'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.X.X'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.X.X'
}
Replace 2.X.X
with the latest version of ExoPlayer. Then, initialize the player in your activity or fragment:
class MainActivity : AppCompatActivity() {
private lateinit var player: ExoPlayer
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
player = ExoPlayer.Builder(this).build()
val playerView = findViewById<PlayerView>(R.id.player_view)
playerView.player = player
val mediaItem = MediaItem.fromUri("https://example.com/video.mp4")
player.setMediaItem(mediaItem)
player.prepare()
}
override fun onDestroy() {
super.onDestroy()
player.release()
}
}
Competitor Comparisons
VLC for Android, Android TV and ChromeOS
Pros of VLC-android
- Supports a wider range of media formats and codecs
- Offers more advanced playback features like network streaming and subtitle support
- Has a longer development history and larger community
Cons of VLC-android
- Larger app size due to included codecs and features
- May have higher resource usage for simpler playback scenarios
- Less focused on modern Android development practices
Code Comparison
ExoPlayer:
val player = SimpleExoPlayer.Builder(context).build()
player.setMediaItem(MediaItem.fromUri(videoUri))
player.prepare()
player.play()
VLC-android:
LibVLC libVLC = new LibVLC(context);
MediaPlayer mediaPlayer = new MediaPlayer(libVLC);
mediaPlayer.setMedia(new Media(libVLC, videoUri));
mediaPlayer.play();
ExoPlayer focuses on a more modern, Kotlin-friendly API with a builder pattern, while VLC-android uses a more traditional Java approach. ExoPlayer's API is generally more concise and easier to use for basic playback scenarios.
Both libraries offer powerful media playback capabilities, but ExoPlayer is more tailored for Android-specific use cases and modern development practices. VLC-android provides broader format support and more advanced features, making it suitable for complex media playback requirements.
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
Pros of ijkplayer
- Cross-platform support (Android, iOS, macOS, Windows)
- Based on FFmpeg, providing extensive codec support
- Customizable and lightweight
Cons of ijkplayer
- Less active development and community support
- Potentially more complex setup and integration
- May require more manual configuration for advanced features
Code Comparison
ExoPlayer (Java):
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
MediaItem mediaItem = MediaItem.fromUri(videoUri);
player.setMediaItem(mediaItem);
player.prepare();
player.play();
ijkplayer (Java):
IjkMediaPlayer player = new IjkMediaPlayer();
player.setDataSource(videoUri);
player.prepareAsync();
player.start();
Both ExoPlayer and ijkplayer are popular open-source media players for Android. ExoPlayer, developed by Google, offers a more modern API and better integration with Android's media framework. It excels in adaptive streaming and has extensive documentation. ijkplayer, based on FFmpeg, provides broader codec support and cross-platform compatibility but may require more setup effort. ExoPlayer is generally easier to implement and maintain for Android-specific projects, while ijkplayer might be preferred for cross-platform development or when specific codec support is needed.
Android开源弹幕引擎·烈焰弹幕使 ~
Pros of DanmakuFlameMaster
- Specialized for handling danmaku (bullet comments) in video players
- Optimized for high-performance rendering of large numbers of comments
- Supports various danmaku styles and effects
Cons of DanmakuFlameMaster
- Limited to danmaku functionality, not a full-featured video player
- Less active development and community support compared to ExoPlayer
- Primarily focused on Asian markets where danmaku is popular
Code Comparison
ExoPlayer (Java):
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
player.setMediaItem(MediaItem.fromUri(videoUri));
player.prepare();
player.play();
DanmakuFlameMaster (Java):
DanmakuView danmakuView = findViewById(R.id.danmaku_view);
DanmakuContext danmakuContext = DanmakuContext.create();
danmakuView.prepare(parser, danmakuContext);
danmakuView.showFPS(true);
danmakuView.enableDanmakuDrawingCache(true);
Summary
ExoPlayer is a comprehensive media player library for Android, offering broad codec support and extensive customization options. DanmakuFlameMaster, on the other hand, specializes in rendering danmaku comments over video content. While ExoPlayer provides a complete video playback solution, DanmakuFlameMaster excels in its niche of high-performance comment overlay rendering. The choice between the two depends on the specific requirements of the project, with ExoPlayer being more suitable for general video playback and DanmakuFlameMaster for applications requiring danmaku functionality.
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,16k page size,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片 头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
Pros of GSYVideoPlayer
- More comprehensive out-of-the-box features, including built-in UI components
- Easier to implement for developers with less video playback experience
- Better support for Chinese documentation and community
Cons of GSYVideoPlayer
- Less flexible for custom implementations compared to ExoPlayer
- Smaller community and potentially slower updates
- May have a steeper learning curve for developers familiar with ExoPlayer
Code Comparison
ExoPlayer basic implementation:
val player = SimpleExoPlayer.Builder(context).build()
player.setMediaItem(MediaItem.fromUri(videoUri))
player.prepare()
player.play()
GSYVideoPlayer basic implementation:
val videoPlayer = StandardGSYVideoPlayer(this)
videoPlayer.setUp(videoUrl, true, "Video Title")
videoPlayer.startPlayLogic()
Both libraries offer straightforward implementation, but GSYVideoPlayer provides more built-in functionality with fewer lines of code. ExoPlayer requires additional setup for UI components but offers more granular control over the player's behavior.
VAP是企鹅电竞开发,用于播放特效动画的实现方案。具有高压缩率、硬件解码等优点。同时支持 iOS,Android,Web 平台。
Pros of VAP
- Specialized for animated stickers and short video effects
- Lightweight and optimized for mobile devices
- Supports alpha channel for transparent animations
Cons of VAP
- Limited to specific use cases (animated effects)
- Less comprehensive media playback features
- Smaller community and ecosystem compared to ExoPlayer
Code Comparison
ExoPlayer (Java):
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
player.setMediaItem(MediaItem.fromUri(videoUri));
player.prepare();
player.play();
VAP (Kotlin):
val animView = findViewById<AnimView>(R.id.anim_view)
animView.setVideoPath(filePath)
animView.start()
Summary
ExoPlayer is a versatile media player for Android, supporting various formats and streaming protocols. It offers extensive customization options and is widely used in many applications.
VAP, on the other hand, is a specialized solution for playing short video animations with alpha channels. It's optimized for mobile devices and focuses on efficient rendering of animated effects.
While ExoPlayer provides a comprehensive media playback solution, VAP excels in its niche of animated stickers and short video effects. The choice between the two depends on the specific requirements of your project.
ncnn is a high-performance neural network inference framework optimized for the mobile platform
Pros of ncnn
- Lightweight and efficient neural network inference framework
- Cross-platform support (Android, iOS, Windows, Linux, etc.)
- Optimized for mobile and embedded devices
Cons of ncnn
- Limited to neural network inference, not a full media player
- Steeper learning curve for non-ML developers
- Smaller community and ecosystem compared to ExoPlayer
Code Comparison
ExoPlayer (Java):
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
MediaItem mediaItem = MediaItem.fromUri(videoUri);
player.setMediaItem(mediaItem);
player.prepare();
player.play();
ncnn (C++):
ncnn::Net net;
net.load_param("model.param");
net.load_model("model.bin");
ncnn::Mat in = ncnn::Mat::from_pixels(image_data, ncnn::Mat::PIXEL_BGR, width, height);
ncnn::Mat out;
net.extract("output", out);
Summary
ExoPlayer is a versatile media player for Android, while ncnn is a lightweight neural network inference framework. ExoPlayer is more suitable for general media playback, while ncnn excels in running machine learning models on mobile and embedded devices. The choice between them depends on the specific requirements of your project, whether it's media playback or neural network inference.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ExoPlayer
This GitHub project is deprecated. The latest version of ExoPlayer is published as part of AndroidX Media3.
All users should migrate to AndroidX Media3. Please refer to our migration guide and script to move your codebase to the Media3 package names.
- As of 2024-04-03 we have stopped pushing commits to the
dev-v2
branch in this repository. New ExoPlayer code is available in the AndroidX Media GitHub repository: https://github.com/androidx/media exoplayer:2.19.1
was the last artifact released from this project, we don't plan to release any more.
Top Related Projects
VLC for Android, Android TV and ChromeOS
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
Android开源弹幕引擎·烈焰弹幕使 ~
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,16k page size,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
VAP是企鹅电竞开发,用于播放特效动画的实现方案。具有高压缩率、硬件解码等优点。同时支持 iOS,Android,Web 平台。
ncnn is a high-performance neural network inference framework optimized for the mobile platform
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot