Skip to content

anthonyjiang888/ExoPlayer

Repository files navigation

ExoPlayerFilter

Platform API

This library uses OpenGL Shaders to apply effects on ExoPlayer video at Runtime and
depends EXOPlayer core 2.10.2.

Gradle

Step 1. Add the JitPack repository to your build file

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

    dependencies {
        implementation 'com.github.MasayukiSuda:ExoPlayerFilter:v0.2.4'
        implementation 'com.google.android.exoplayer:exoplayer-core:2.10.2'
    }

This library depends ExoPlayer core 2.10.2

Sample Usage

STEP 1

Create SimpleExoPlayer instance. In this case, play MP4 file.
Read this if you want to play other video formats.

    // Produces DataSource instances through which media data is loaded.
    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(this, "yourApplicationName"));

    // This is the MediaSource representing the media to be played.
    MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
           .createMediaSource(Uri.parse(Constant.STREAM_URL_MP4_VOD_LONG));

    // SimpleExoPlayer
    player = ExoPlayerFactory.newSimpleInstance(this);
    // Prepare the player with the source.
    player.prepare(videoSource);
    player.setPlayWhenReady(true);

STEP 2

Create EPlayerView and set SimpleExoPlayer to EPlayerView.

    ePlayerView = new EPlayerView(this);
    // set SimpleExoPlayer
    ePlayerView.setSimpleExoPlayer(player);
    ePlayerView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    // add ePlayerView to WrapperView
    ((MovieWrapperView) findViewById(R.id.layout_movie_wrapper)).addView(ePlayerView);
    ePlayerView.onResume();

STEP 3

Set Filter. Filters is here.
Custom filters can be created by inheriting GlFilter.java.

    ePlayerView.setGlFilter(new GlSepiaFilter());

Special Thanks to

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages