Filter ExoPlayer

ExoPlayerFilter

ExoPlayerFilter

Filter ExoPlayer. I created a library that can do that. If you are involved in a video editing project, you may have considered whether to make it once.

I thought about creating it because ExoPlayer has double speed playback.

The texture used in mediaCodec is filtered by OpenGL.

Dependencies

dependencies {
    compile 'com.daasuu:ExoPlayerFilter:0.1.3'
}

Sample Usage STEP 1 Create an instance of SimpleExoPlayer. This time I will play the mp4 file. If you want to play other formats such as HLS, please refer to Official Site.

    BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

    // Measures bandwidth during playback. Can be null if not required.
    DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter();
    // Produces DataSource instances through which media data is loaded.
    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context, "yourApplicationName"), defaultBandwidthMeter);
    // Produces Extractor instances for parsing the media data.
    ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
    // This is the MediaSource representing the media to be played.
    MediaSource videoSource = new ExtractorMediaSource(Uri.parse(MP4_URL), dataSourceFactory, extractorsFactory, null, null);

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

STEP 2 Create EPlayerView and set SimpleExoPlayer.

    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 the filter. The list of filters is here. If you want to customize the filter, inherit GlFilter. Can be created.

    ePlayerView.setGlFilter(new GlSepiaFilter());

By all means, please take a look at ExoPlayerFilter and I would be very happy if you could add Star. Pull requests such as making such a filter are also welcome!

Recommended Posts

Filter ExoPlayer
[Java] Servlet filter