-
Notifications
You must be signed in to change notification settings - Fork 575
Description
Version
Media3 1.3.1
More version details
Main
Devices that reproduce the issue
All Android devices tested
Devices that do not reproduce the issue
no one
Reproducible in the demo app?
Yes
Reproduction steps
We're facing an issue trying to retrieve the trickplay's images from ImageTrack on Exoplayer Media3 v.1.3.1.
ExoplayerPoc(Trickplay Issue).zip
Open the attached demo app.
An asset automatically start with imageTrack selected by default by:
_val trackSelector = DefaultTrackSelector(context).apply {
setParameters(buildUponParameters().setPrioritizeImageOverVideoEnabled(true).build())
}
val player = ExoPlayer.Builder(context)
.setMediaSourceFactory(mediaSourceFactory)
.setTrackSelector(trackSelector)
.build()_
After that we provide an ImageOutput class to the player:
player.setImageOutput(CustomImageOutput())
where CustomImageOutput is:
_class CustomImageOutput() : ImageOutput {
override fun onImageAvailable(presentationTimeUs: Long, bitmap: Bitmap) {
Log.e("IMAGE OUTPUT","bitmap: $presentationTimeUs $bitmap")
Log.e("IMAGE OUTPUT","height: ${bitmap.height}")
Log.e("IMAGE OUTPUT","width: ${bitmap.width}")
}
override fun onDisabled() {
Log.e("IMAGE OUTPUT", "on disabled")
}
}_
In our VoD the image track provides images of 1248x936, a grid of 3x4 images of 416x234. The streaming plays fine for the first 4 seconds where we could correctly retrieve the first 3 images:
- bitmap time(presentationTimeUs): 0, height: 234, width: 416
- bitmap: time: 2000000, height: 234, width: 416
- bitmap: time: 4000000, height: 234, width: 416
At 4th image we receive:
Playback error
androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:701)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:236)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
at android.graphics.Bitmap.createBitmap(Bitmap.java:876)
at android.graphics.Bitmap.createBitmap(Bitmap.java:836)
at androidx.media3.exoplayer.image.ImageRenderer.cropTileFromImageGrid(ImageRenderer.java:578)
at androidx.media3.exoplayer.image.ImageRenderer.drainOutput(ImageRenderer.java:343)
at androidx.media3.exoplayer.image.ImageRenderer.render(ImageRenderer.java:182)
at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1112)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:544)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:236)
at android.os.HandlerThread.run(HandlerThread.java:67)
Expected result
The image track play successfully providing image for all the content duration
Actual result
The image track crashes trying to retrieve the 4th bitmap with the following error:
Playback error
androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:701)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:236)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
at android.graphics.Bitmap.createBitmap(Bitmap.java:876)
at android.graphics.Bitmap.createBitmap(Bitmap.java:836)
at androidx.media3.exoplayer.image.ImageRenderer.cropTileFromImageGrid(ImageRenderer.java:578)
at androidx.media3.exoplayer.image.ImageRenderer.drainOutput(ImageRenderer.java:343)
at androidx.media3.exoplayer.image.ImageRenderer.render(ImageRenderer.java:182)
at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1112)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:544)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:236)
at android.os.HandlerThread.run(HandlerThread.java:67)
Media
All details provided in the sample app attached.
val headers: MutableMap<String, String> = HashMap()
headers["form"] = "json"
headers["schema"] = "1.0"
headers["token"] = "eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJydGUtcHJkLXByZC10cnQvYW5vbnltb3VzX25ncnBfcGxheWVyQHJ0ZS5pZSIsImlzcyI6IjEiLCJleHAiOjE3MjQ4NTE3NTgsImlhdCI6MTcxNzA3NTc1ODU3MywianRpIjoiYjY0NTM1OTYtOTg2MS00OGQ3LWJiN2EtNTU4MTkxOTQ2NDZkIiwiZGlkIjoicnRlLXByZC1wcmQtdHJ0IiwidW5tIjoiYW5vbnltb3VzX25ncnBfcGxheWVyQHJ0ZS5pZSIsImN0eCI6IntcInVzZXJOYW1lXCI6XCJhbm9ueW1vdXNfbmdycF9wbGF5ZXJAcnRlLmllXCJ9XG4iLCJvaWQiOiIyNzAwODk0MDAxIn0.cwupE6ZDsDTD_b6HQIvWibGZz0N23z6_jn2KbCVEyZ2CoeQsJ3VjpdvbPCw1QovMuLqGeFiFlIDQIvOKT97yxwSs6mFP47GkQYSOxCj52sTP2OKpQzt9gkC3oSzIQ4W6D7AL9Yd1HLF06YQdSET1wJWzV6CVYuCc_ilUw3DVjjGNrugI0pvf7AjlkFI21mcMEk9S9eKqhuu_6oKtMLkzbvJepHzNJhcSUmeE4ZhOMhOFi4ighAh4_NFm5leAR9nj_Ysp7lTBUrmCb6ZVrTfQ2Q65WlU2-fwccJWTBZFeB7SlZ_M7i_gcUu4BbGHcHz8cH8RTikY6YC13ZzKOPYm" +
"rPg"
headers["account"] = URLEncoder.encode(mpxAccount, "utf-8")
return DefaultDrmSessionManager.Builder()
.build(
CustomDrmCallback(
headers = headers,
bodyParams = mutableMapOf("releasePid" to mediaPid),
context = context
)
)
Bug Report
- You will email the zip file produced by
adb bugreport
to android-media-github@google.com after filing this issue.