Unable to play a video with CCL because of NullPointerException
-
24-12-2019 - |
Question
I am trying to play the following video https://v.cdn.vine.co/r/videos/A2798484D41041440198208659456_1391272876299b1ffbbdfb5.mp4_YTmPg6EwCUKAbbQtWT3BQPPxzQj290VxAG5VAywks7da5SRCoUqrp3iuhiFfOlDL.mp4?versionId=XMG6Bt70r4InoH1BonmNYZtgZFkERjm9
with the Cast Companion Library (latest version from this morning), and I am getting the following exception:
java.lang.NullPointerException
at com.google.android.gms.cast.MediaMetadata.hashCode(Unknown Source)
at java.util.Arrays.hashCode(Arrays.java:1260)
at com.google.android.gms.internal.ee.hashCode(Unknown Source)
at com.google.android.gms.cast.MediaInfo.hashCode(Unknown Source)
at java.lang.Object.toString(Object.java:332)
at java.lang.StringBuilder.append(StringBuilder.java:202)
at com.google.sample.castcompanionlibrary.cast.VideoCastManager.loadMedia(VideoCastManager.java:1026)
at com.google.sample.castcompanionlibrary.cast.VideoCastManager.loadMedia(VideoCastManager.java:1010)
I am able to play various other videos with the exact same code. It appears that LOGD(TAG, "loadMedia: " + media);
is getting the hashcode of MediaInfo which is missing something (probably my title in this one video, also the image urls).
EDIT: with a small workaround passing a fake title I got the video to play just fine.
Solution
The fix for this issue will appear in the next release of the framework.
OTHER TIPS
I also had the same problem and it was solved as soon as I added a value for MediaMetadata.KEY_STUDIO.
I had this problem until I had values for both MediaMetadata.KEY_SUBTITLE AND MediaMetadata.KEY_STUDIO.