I’m trying to implement cast feature using Fling SDK from Amazon. Using RemoteMediaPlayer to control / start remote playback, but call to any method of RemoteMediaPlayer just lead to an error:
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Input Description is null
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:191)
at com.hotstar.cast.RemotePlaybackManager$ResultHandler.futureIsNow(RemotePlaybackManager.kt:97)
at com.amazon.whisperplay.fling.media.controller.impl.PlayerDeviceImpl$AsyncFutureTask.done(PlayerDeviceImpl.java:594)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
at java.util.concurrent.FutureTask.run(FutureTask.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.IllegalArgumentException: Input Description is null
at com.amazon.whisperlink.util.Connection.<init>(Connection.java:206)
at com.amazon.whisperlink.util.Connection.<init>(Connection.java:166)
at com.amazon.whisperplay.fling.media.controller.impl.WhisperplayControllerAdaptor.getConnection(WhisperplayControllerAdaptor.java:285)
at com.amazon.whisperplay.fling.media.controller.impl.PlayerDeviceImpl$23.call(PlayerDeviceImpl.java:454)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Code:
class ResultHandler<T>(val message: String, val onResult: (T) -> Unit = {}) : FutureListener<T> {
override fun futureIsNow(result: Future<T>) {
try {
onResult(result.get())
} catch (e: Exception) {
Log.e(TAG, "error in resultHandler for message: $message", e)
}
}
}
fun loadMedia(flingMediaRouteProvider: FlingMediaRouteProvider, remoteMediaPlayer: RemoteMediaPlayer) {
val uri = Uri.parse("https://ia804502.us.archive.org/2/items/BigBuckBunny1280x720Stereo/big_buck_bunny_720_stereo.mp4")
val metadataBundle = Bundle().apply {
putString("type", "video/mp4")
putString("title", "Big Buck Bunny")
putString(MediaItemMetadata.KEY_TITLE, "Big Buck Bunny")
putString(MediaItemMetadata.KEY_ARTWORK_URI, "https://peach.blender.org/wp-content/uploads/bbbscore_cover_small.jpg")
}
val metadataJson = flingMediaRouteProvider.getJSONFromBundle(metadataBundle)
// We will get "java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Input Description is null" here in result handler
remoteMediaPlayer.setMediaSource(uri.toString(), metadataJson.toString(), true, false).getAsync(ResultHandler("performLoadMedia"))
}
Need to get rid of errors and make sure code works as expected
Environment:
Android Version (mobile): 14
Fling SDK Version: 1.6.3
Mobile device: Pixel 5
FireTV device: FireTV 4K Max