Reputation: 103
I'm trying to play a local video (mp4) on Google Glass using VIDEOPLAYER.
My code is:
Intent i = new Intent();
i.setAction("com.google.glass.action.VIDEOPLAYER");
i.putExtra("video_url", "android.resource://" + getPackageName() +"/"+R.raw.close_upper_case_mp4);
startActivity(i);
When I launch the code (on "startActivity(i)"), I get:
java.lang.NullPointerException
at org.eclipse.debug.internal.ui.DebugUIPlugin.launchInBackground(DebugUIPlugin.java:1257)
at org.eclipse.debug.ui.DebugUITools.launch(DebugUITools.java:757)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.debugRunningApp(AndroidLaunchController.java:176)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.clientChanged(AndroidLaunchController.java:1742)
at com.android.ddmlib.AndroidDebugBridge.clientChanged(AndroidDebugBridge.java:912)
at com.android.ddmlib.Device.update(Device.java:600)
at com.android.ddmlib.Client.update(Client.java:903)
at com.android.ddmlib.HandleWait.handleWAIT(HandleWait.java:88)
at com.android.ddmlib.HandleWait.handleChunk(HandleWait.java:66)
at com.android.ddmlib.MonitorThread.callHandler(MonitorThread.java:414)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:322)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
and it seems like the Glass is loading something but nothing happens.
I think that the path is not correct, because I tried other things (like MediaPlayer) and I get the same result.
Any clues?
Upvotes: 4
Views: 582
Reputation: 589
I faced the same issue. com.google.glass.action.VIDEOPLAYER does not access local resources of the project. you can solve this by using video view or place your video on the external storage directory of the glass.
Upvotes: 0
Reputation:
According to this answer, you have to set the path like this:
"android.resource://[package]/[res type]/[res name]"
so it would be
"android.resource://" + getPackageName() +"/raw/" + R.raw.close_upper_case_mp4
It may also be that the path is not properly encoded, try
Uri.parse("android.resource://" + getPackageName() +"/raw/" + R.raw.close_upper_case_mp4).toString();
(with or without the "/raw" part)
Upvotes: 1