All Projects → Orfium → Rxmusicplayer Android

Orfium / Rxmusicplayer Android

Licence: apache-2.0
An android music player using ExoPlayer and RxJava2

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Rxmusicplayer Android

CarouselGifViewer
Efficiently display a list of GIFs in a carousel (RecyclerView).
Stars: ✭ 33 (-74.02%)
Mutual labels:  exoplayer, rxjava2
Dkvideoplayer
Android Video Player. 安卓视频播放器,封装MediaPlayer、ExoPlayer、IjkPlayer。模仿抖音并实现预加载,列表播放,悬浮播放,广告播放,弹幕
Stars: ✭ 3,796 (+2888.98%)
Mutual labels:  player, exoplayer
KingPlayer
🎬 一个专注于 Android 视频播放器的基础库,无缝切换内核。(IjkPlayer、ExoPlayer、VlcPlayer、MediaPlayer)
Stars: ✭ 35 (-72.44%)
Mutual labels:  player, exoplayer
BakingApp
Udacity Android Developer Nanodegree, project 2.
Stars: ✭ 54 (-57.48%)
Mutual labels:  exoplayer, rxjava2
Rxdownloader
- Reactive Extension Library for Android to download files
Stars: ✭ 40 (-68.5%)
Mutual labels:  rxjava2, library
kaltura-player-android
Kaltura Player is a rich, easy to integrate and easy to use video player for all media types and ad scenarios you need. - based on Google ExoPlayer
Stars: ✭ 22 (-82.68%)
Mutual labels:  player, exoplayer
Gsyvideoplayer
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
Stars: ✭ 16,948 (+13244.88%)
Mutual labels:  player, exoplayer
Android-hls
最近公司产品需要,调研hls(m3u8) aes-128 解密播放 . 分析 51Cto, 慕课
Stars: ✭ 73 (-42.52%)
Mutual labels:  player, exoplayer
Fantasy
A music player based exoplayer. exquisite and fluent.
Stars: ✭ 23 (-81.89%)
Mutual labels:  player, exoplayer
Xamarinmediamanager
Cross platform Xamarin plugin to play and control Audio and Video
Stars: ✭ 647 (+409.45%)
Mutual labels:  player, exoplayer
flutter playout
AV Playout in Flutter
Stars: ✭ 129 (+1.57%)
Mutual labels:  player, exoplayer
Kotlin Link Parser
Link preview for android
Stars: ✭ 50 (-60.63%)
Mutual labels:  rxjava2, library
ARVI
Android library designed to simplify the implementation of the video autoplay in the RecyclerView
Stars: ✭ 69 (-45.67%)
Mutual labels:  player, exoplayer
p2p-cdn-sdk-android
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 39 (-69.29%)
Mutual labels:  player, exoplayer
CommenPlayer
CommenPlayer ——Video player, Support ijkPlayer, Vlc, MediaPlayer, ExoPlayer; 视频播放器,支持ijkPlayer,Vlc,MediaPlayer,ExoPlayer
Stars: ✭ 81 (-36.22%)
Mutual labels:  player, exoplayer
Playerbase
The basic library of Android player will process complex business components. The access is simple。Android播放器基础库,专注于播放视图组件的高复用性和组件间的低耦合,轻松处理复杂业务。
Stars: ✭ 2,814 (+2115.75%)
Mutual labels:  player, exoplayer
Jcplayer
🎵 A simple audio player for Android applications.
Stars: ✭ 209 (+64.57%)
Mutual labels:  library, player
Phoenix For Vk
Yet another VK client for Android
Stars: ✭ 131 (+3.15%)
Mutual labels:  rxjava2, exoplayer
Musicplayer
Implemented using Clean Arch, MVVM, LiveData, Room, Koin, Coil, Service, Notification and ExoPlayer
Stars: ✭ 413 (+225.2%)
Mutual labels:  player, exoplayer
Thirtyinch
a MVP library for Android favoring a stateful Presenter
Stars: ✭ 1,052 (+728.35%)
Mutual labels:  rxjava2, library

Android Arsenal

RxMusicPlayer

An android music player using ExoPlayer and RxJava2.

Introduction

RxMusicPlayer is a part of our music player in Orfium new android application.
Using subjects and sealed classes, media manager can emit the latest state of exoplayer, allowing views and classes to observe it and react according to its state, without the need to have a reference to the media manager or exoplayer itself.

Initialization

Before start using RxMusicPlayer you have to call the method that starts the Media Service

RxMusicPlayer.start(context)

or

RxMusicPlayer.start(context, Intent(this, MainActivity::class.java))

if you want to specify the activity you want to launch from notification

Usage

Create a Media item class that contains all the necessary data information and call playStop extension function on it.

Example:

val media = Media(
            id = 1, title = "Closer and Closer . . . 25.11.2018", artist = "Strobi-wan", duration = 7861, 
            image = "https://s3-us-west-2.amazonaws.com/orfium-public/tracks/artwork/45c4ad6b21dc4aecad4bee0bafefb613.jpg",
            streamUrl = "https://s3-us-west-2.amazonaws.com/orfium-public/tracks/8c7465df1f0c4e48af10ad4f6c17a2ef.mp3"
        )
media.playStop()

You can also check if a Media item is currently playing

if (media.isPlaying())

or add/remove it from queue

media.addQueue()

media.removeQueue()

If you wish not to use the extension functions you can use RxMusicPlayer action to emit a new action that the MediaManager will handle. Here is the full list of actions that the MediaManager can handle

Example:

RxMusicPlayer.action.onNext(Action.pause())

or

RxMusicPlayer.action.onNext(Action.seek(position))

To observe the changes on media player state just subscribe to RxMusicPlayer state, that will emit the current PlaybackState along with the current Media item on Queue. When a new observer subscribes to RxMusicPlayer state, it immediately gets notified about the current PlaybackState. You can find all states here

RxMusicPlayer.state
            .distinctUntilChanged()
            .subscribe { state ->
                when (state) {
                    is PlaybackState.Buffering -> /* Your code */
                    is PlaybackState.Playing -> showPlaying(state.media)
                }
            }

A notification is provided by default when the state gets changes. You can configure notification's icons by overriding them.

RxMusicPlayer allows you to observe changes in media queue list and the current playback position of exoplayer

RxMusicPlayer.queue
                .subscribe { queueData -> /* Your code */ }

RxMusicPlayer.position
                .observeOn(AndroidSchedulers.mainThread())
                .distinctUntilChanged()
                .subscribe { position -> /* Your code */ }

Setup

The latest library version is

Add the JitPack repository in your build.gradle (top level module):

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

And add the dependency in the build.gradle of the module:

implementation 'com.github.Orfium:RxMusicPlayer-android:LATEST_VERSION'

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].