Play local video on Glass

I am trying to play local video (mp4) in 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 run 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 glass is loading something, but nothing is happening.

I think the path is wrong because I tried other things (like MediaPlayer) and I get the same result.

Any clues?

+4
source share
2 answers

I ran into the same problem. com.google.glass.action.VIDEOPLAYER does not access the local resources of the project. You can solve this problem using video viewing or put your video in the external glass storage directory.

0

this :

"android.resource://[package]/[res type]/[res name]"

"android.resource://" + getPackageName() +"/raw/" + R.raw.close_upper_case_mp4

, ,

Uri.parse("android.resource://" + getPackageName() +"/raw/" + R.raw.close_upper_case_mp4).toString();

( "/raw" )

+1

Source: https://habr.com/ru/post/1534239/


All Articles