Metascene.Videos
This library enables you to push the webOS video player or editor onto your application's scene stack.
Using Metascene.Videos
-
include mojoloader.js in your sources
-
load the library
var Videos = MojoLoader.require({name: "metascene.videos", version: "1.0"})["metascene.videos"]; -
push the scene, either nowplaying or video editor
Videos.Push(this.controller.stageController, Videos.Nowplaying, params);
Scenes
Videos.Nowplaying
Videos.Push(this.controller.stageController, VideoLibrary.Nowplaying, params);
where params is an object with any number of the following properties:
| param | type | req'd or opt | default | description |
| _id | string | required | null | the mojodb id of the video to play. If an _id is not supplied, a video obj or target must be supplied instead |
| video | object | optional | null | a video object from mojodb |
| target | string | optional | null | the uri of the video to play |
| initalPos | int | optional | 0 | position (in seconds) from which the video will start playing |
| videoID | int | optional | null | used internally by the app to store the latest initial position |
| thumbUrl | string | optional | app's generic thumb | required by the share flow, but not used otherwise |
| title | string | optional | uses target as title | title of the video to be displayed |
| autoplay | boolean | optional | true | if false, stops the video from autoplaying |
| size | int | optional | null | required by the share flow, but not used otherwise. Size of the video in bytes |
| duration | int | optional | null | required by the share flow, but not used otherwise. Duration of the video in seconds |
| isNewCard | boolean | optional | false | if true, the videoplayer closes the whole stage on error |
| enableControls | boolean | optional | true | if false, video cannot be manipulated by transport controls |
Using _id or video are the preferred methods, the other params are deprecated.
Videos.Videoeditor
If you want push the video editor instead:
VideoLibrary.Push(this.controller.stageController, VideoLibrary.Videoeditor, params);
In addition to the nowplaying params, video editor can also take the following:
| param | type | req'd or opt | default | description |
| popAfterEdit | boolean | optional | false | if true, the scene will pop after a video edit is successfu |
| openInEditMode | boolean | optional | false | if true, the nowplaying scene will immediately open the editor |
| callback | function | optional | null | this callback will be called after a video edit is successful with an object full of various params |
| timeLimit | int | optional | null | number of seconds that limits how far the edit handles can be dragged apart |
| sizeLimit | int | optional | null | number of bytes that limits how far the edit handles can be dragged apart. Converted to a timeLimit based on the video's bitrate |
| destination | string | optional | DCIM standard filename | where the edited video should go once trimmed |
| transcode | boolean | optional | false | if true, the editor simulates the trim without actually doing the trim |