2 Video Player Launch¶
2.1 Action Name¶
In Android level, you need to initiate an Intent and set the action “picovr.intent.action.player” to start the built-in video player.
2.2 Parameter Introduction¶
Here are the parameters to input in the Intent. For local video, the uri (path) and title are required. For live stream resource, you should at least input uri.
Parameter | Type | Remark |
---|---|---|
uri | String | Play address (required) |
title | String | The name of the video (required) |
videoType | String | Video type |
playTime | Int | Play the starting point |
videoSource | String | Video Source. 0: online video; 1: local video; 2: flying screen app; 3: live video; 4: lebo app. |
scenes | Int | Change the background.0 for pmax;1 for empty;2 for beach cinema. |
position | Float | Camera position (Available only in cinema mode) |
seekPlay | Boolean | Jump to the last played location.True for playing from start,false for returning to the last point.True means the video will be played from beginning after the screen is off and on again. |
loop | Boolean | Whether videos in a play list are looped.True for looping the list. |
isControl | Boolean | Whether the control panel shows.True for visible. |
play_list | String | The video play list. Format of the list should be JSON. |
shouldPlayIndex | Int | Choose a video in play list to play. |
play_list JSON should be recorded as
[{\"index\":0,\"name\":\"test2D.mp4\",\"playMode\":0,\"url\":\"%2Fsdcard%2Ftest2D.mp4\"},{\"index\":1,\"name\":\"test.mp4\",\"playMode\":2,\"url\":\"%2Fsdcard%2Ftest.mp4\"}]
2.3 Permission¶
In AndroidManifest.xml file, the following permissions need to be added.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
2.4 Supported Video Format¶
The video types supported and the parameters for each type are listed below,
Video Type | Parameter | |
---|---|---|
_2D | 2D video | 0 |
_3D_LR | 3D video with left and right side image combined | 1 |
_360 | 360 video | 2 |
_3D360_TB | 3D 360 video in top and bottom format | 3 |
_3D360_BT | 3D 360 video in bottom and top format | 4 |
_3D360_LR | 3D 360 video in left and right format | 5 |
_3D360_RL | 3D 360 video in right and left format | 6 |
_3D_TB | 3D video in top and bottom format | 7 |
_3D_BT | 3D video in bottom and top format | 8 |
_3D_RL | 3D video in right and left format | 9 |
_180 | 180° 2D | 10 |
_3D180_TB | 180° 3D in top and bottom format | 11 |
_3D180_BT | 180° 3D in bottom and top format | 12 |
_3D180_LR | 180° 3D in left and right format | 13 |
_3D180_RL | 180° 3D in right and left format | 14 |
_2DFishEye | 2D video in fisheye mode | 15 |
_3DFishEye_TB | 3D video in fisheye mode and top and bottom format | 16 |
_3DFishEye_BT | 3D video in fisheye mode and bottom and top format | 17 |
_3DFishEye_LR | 3D video in fisheye mode and left and right format | 18 |
_3DFishEye_RL | 3D video in fisheye mode and right and left format | 19 |
_CubeMap | Youtube | 20 |
_CubeMap_LR | Youtube 3D in left and right format | 21 |
Please note if you don’t specify any video type, it will be 0 (2D) by default.
2.5 Sample Code¶
You can download aar file at https://github.com/picoxr/launch-pico-player/blob/master/resource/launch-pico-player.aar
To call functions in the aar file in a Unity project, please refer to the sample code:
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject videoPlayer = new AndroidJavaObject("com.picovr.picoplaymanager.PicovrLaunchPlayer");
videoPlayer.Call<AndroidJavaObject>("uri", "/sdcard/test.mp4", false)
.Call<AndroidJavaObject>("playTime", 20)
.Call<AndroidJavaObject>("scenes", 2)
...
.Call("launchVideoPlayer", context);