androidx / androidx/media

Picture in Picture overlay in Exoplayer

Open
#806 4 comments 0 reactions 1 assignee View on GitHub

@droid-girl is already working on this.

Since Nov 15, 2023.

editing question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

For Bitmap or Drawable overlay we use this code

OverlaySettings logoSettings =
               new OverlaySettings.Builder()  .build();
       Drawable logo = getPackageManager().getApplicationIcon(getPackageName());
       logo.setBounds(
               /* left= */ 0, /* top= */ 0, logo.getIntrinsicWidth(), logo.getIntrinsicHeight());
       TextureOverlay logoOverlay = DrawableOverlay.createStaticDrawableOverlay(logo, logoSettings);

       overlaysBuilder.add(logoOverlay);
       ImmutableList<TextureOverlay> overlays = overlaysBuilder.build();
    
 
         return overlays.isEmpty() ? null : new OverlayEffect(overlays);

While checking the code we could find the Bitmapoverlay

and the

DrawableOverlay

What is the video overlay equivalent for video overlay , We tried using bitmap overlay

like this

 OverlaySettings logoSettings = new OverlaySettings.Builder()
                    .setScale(.25f, .25f)
                    .setOverlayFrameAnchor(1, -1)
                    .setBackgroundFrameAnchor(.9f, -.7f)
                    .build();

            TextureOverlay logoOverlay = BitmapOverlay.createStaticBitmapOverlay(this,OverLayVideoUri, logoSettings);

            overlaysBuilder.add(logoOverlay);
            ImmutableList<TextureOverlay> overlays = overlaysBuilder.build();
         outputPlayer.setVideoEffects(Collections.singletonList(new OverlayEffect(overlays)));

But nothing was rendered

There few more questions we would like to know

  1. how do we apply separate effects for individual videos, say we have 3 different videos for each video we want separate effects, like we rotate first video, grayscale second video, and crop third video how can we do this and render it in exoplayer

  2. How to adjust the width and height of various videos, like in previous example we have first video of 854 x 480 , second is 1280 x 720 and third is 426 x 240 we want all these videos to be rendered and transformed to 1280 x 720 how can we do this

3)some thing related to above question render different aspect ratios like, 4:3, 16:9 etc

while Transform has the options to use

EditedMediaItem

which provides better option to have changes specific to a particular video

While the setVideoEffects provides options to apply effect to videos , it seems to apply at the exoplayer level to all videos instead of to a specific video, it will be great if we have similar option like EditedMediaItem for exoplayer also.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.