HybridMediaPlayer

Additional

Language
Java
Version
1.4.2 (Jul 24, 2017)
Created
Nov 9, 2016
Updated
Jul 24, 2017
Owner
Mateusz Kaflowski (mkaflowski)
Contributor
Mateusz Kaflowski (mkaflowski)
1
Activity
Badge
Generate
Download
Source code

Promotion

HybridMediaPlayer

Android music player from URL. Uses ExoPlayer and MediaPlayer for lower APIs.

Installation

To use the library, first include it your project using Gradle

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

dependencies {
        compile 'com.github.mkaflowski:HybridMediaPlayer:1.x'
}

How to use

        HybridMediaPlayer mediaPlayer = HybridMediaPlayer.getInstance(context);
        mediaPlayer.setDataSource(url);
 mediaPlayer.setPlayerView(this, playerView);
 
        mediaPlayer.prepare();

        mediaPlayer.setOnCompletionListener(this);
        mediaPlayer.setOnErrorListener(this);
        mediaPlayer.setOnPreparedListener(this);
        
        mediaPlayer.play();
        mediaPlayer.seekTo(1500);
        mediaPlayer.pause();
 
 mediaPlayer.setVolume(0.5f);
        
        mediaPlayer.release();

Methods for ExoPlayer only

        ExoMediaPlayer mediaPlayer = new ExoMediaPlayer(this)
        mediaPlayer.setDataSource(url1, url2, url3, ...);
 mediaPlayer.setPlayerView(this, playerView);
 
        mediaPlayer.prepare();

        mediaPlayer.setOnPositionDiscontinuityListener(this);
 mediaPlayer.setOnTracksChangedListener(this);
        
 mediaPlayer.hasVideo();
        mediaPlayer.seekTo(windowPosition,time);
 
 mediaPlayer.setSupportingSystemEqualizer(true);
 //FOR EDITING PLAYLIST
 mediaPlayer.getMediaSource();
 
        mediaPlayer.release();