Skip to content

Support clipping of multi-period content #6234

@brianchu

Description

@brianchu

Issue description

Want to loop a video (mp4) for certain fix period of time and if it doesn't fit perfectly, it will play and finish partially within the time limit. so thinking combine X numbers of source with concatenatingMediaSource and use ClippingMediaSource to clip the media.

other option is use LoopingMedaiSource() with ClippingMediaSource, basically

ClippingMediaSource(LoopingMediaSource(...), ...)

but it gives me the same error.

com.google.android.exoplayer2.source.ClippingMediaSource$IllegalClippingException: Illegal clipping: invalid period count

Reproduction steps

I use ConcatenatingMediaSource with two (same) mp4 and then wrap that with ClippingMediaSource.

  val baseMediaSource1 = ProgressiveMediaSource.Factory(...).createMediaSource(videoUrl)
  val baseMediaSource2 = ProgressiveMediaSource.Factory(...).createMediaSource(videoUrl)

  val concat = ConcatenatingMediaSource(true, baseMediaSource1, baseMediaSource2)
  mediaSource = ClippingMediaSource(concat, <duration for 10seconds>)

Link to test content

Any mp4

A full bug report captured from the device

I can offer you the full report but I feel the stack is enough here.

Version of ExoPlayer being used

2.10.3

Device(s) and version(s) of Android being used

emulator, S9, Pixel 3.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions