google / google/ExoPlayer

Support clipping of multi-period content

Open
#6,234 8 comments 0 reactions 1 assignee Claimed by @marcbaechinger View on GitHub
enhancement
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

### 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, )
```

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.