I am using GMF sample to play Video in my app, where I am fetching video title and url from live JSON, here is the sample of my JSON :
{
"videos": [
{
"title":"Video 1",
"url":"88.mp4"
},
{
"title":"Video 2",
"url":"l5.mp4"
}
]}
And this is what my code looks like :
MainActivity.java:
JSONObject jsono = new JSONObject(data);
JSONArray jarray = jsono.getJSONArray("videos");
for (int i = 0; i < jarray.length(); i++) {
JSONObject object = jarray.getJSONObject(i);
Videos video = new Videos();
video.setTitle(object.getString("title"));
video.setUrl(object.getString("url"));
videosArrayList.add(video);
}
Whenever, I do tap on any of the list item to play Video, getting NPE
, see complete Log:
03-17 13:14:34.667 18799-18799/com.google.googlemediaframeworkdemo.demo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.google.googlemediaframeworkdemo.demo, PID: 18799
java.lang.NullPointerException
at com.google.android.libraries.mediaframework.exoplayerextensions.RendererBuilderFactory.createRendererBuilder(RendererBuilderFactory.java:34)
at com.google.android.libraries.mediaframework.layeredvideo.LayerManager.<init>(LayerManager.java:78)
at com.google.android.libraries.mediaframework.layeredvideo.SimpleVideoPlayer.<init>(SimpleVideoPlayer.java:112)
at com.google.android.libraries.mediaframework.layeredvideo.SimpleVideoPlayer.<init>(SimpleVideoPlayer.java:81)
at com.google.googlemediaframeworkdemo.demo.adplayer.ImaPlayer.<init>(ImaPlayer.java:388)
at com.google.googlemediaframeworkdemo.demo.adplayer.ImaPlayer.<init>(ImaPlayer.java:434)
at com.google.googlemediaframeworkdemo.demo.adplayer.ImaPlayer.<init>(ImaPlayer.java:467)
at com.google.googlemediaframeworkdemo.demo.MainActivity$1.onItemClick(MainActivity.java:81)
at android.widget.AdapterView.performItemClick(AdapterView.java:299)
at android.widget.AbsListView.performItemClick(AbsListView.java:1152)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3014)
at android.widget.AbsListView$3.run(AbsListView.java:3865)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
03-17 13:14:34.803 18799-18861/com.google.googlemediaframeworkdemo.demo D/dalvikvm: threadid=17: interp stack at 0x56eb0000
03-17 13:14:34.803 18799-18861/com.google.googlemediaframeworkdemo.demo D/dalvikvm: init ref table
03-17 13:14:34.803 18799-18861/com.google.googlemediaframeworkdemo.demo D/dalvikvm: init mutex
03-17 13:14:34.903 18799-18861/com.google.googlemediaframeworkdemo.demo D/MediatekClassFactory: createInstance(): Begin = 9861250
03-17 13:14:34.904 18799-18861/com.google.googlemediaframeworkdemo.demo D/MediatekClassFactory: create Instance with : interface com.mediatek.common.telephony.IOnlyOwnerSimSupport
03-17 13:14:34.912 18799-18861/com.google.googlemediaframeworkdemo.demo W/MediatekClassFactory: Tablet not exist!, Get obj from default class
03-17 13:14:34.916 18799-18861/com.google.googlemediaframeworkdemo.demo D/MediatekClassFactory: create Instance from tablet library : com.mediatek.tb.telephony.OnlyOwnerSimSupport
03-17 13:14:34.920 18799-18861/com.google.googlemediaframeworkdemo.demo D/MediatekClassFactory: createInstance(): End = 9861267
I wrote code as I think it should be, so may I know where I am missing ? what I am missing ? and how can i resolve it ?