VideoView

API Reference: UI.VideoView

VideoView is a view to play video clips. Supported formats for both platforms are 3GPP (.3gp) and MPEG-4 (.mp4).

JavaScript
JavaScript
const Page = require("sf-core/ui/page");
const extend = require("js-base/core/extend");
const FlexLayout = require('sf-core/ui/flexlayout');
const Color = require('sf-core/ui/color');
const Button = require('sf-core/ui/button');
const VideoView = require('sf-core/ui/videoview');
var Page1 = extend(Page)(
function(_super) {
_super(this, {
onShow: function(params) {
Application.statusBar.visible = false;
this.headerBar.visible = false;
}
});
this.layout.flexDirection = FlexLayout.FlexDirection.ROW;
this.layout.justifyContent = FlexLayout.JustifyContent.CENTER;
this.layout.alignItems = FlexLayout.AlignItems.CENTER;
var myVideoView = new VideoView({
margin:20,
height: 250,
width: 250,
onReady: function() {
myVideoView.play();
}
});
myVideoView.ios.page = this;
myVideoView.loadURL('http-video-url');
this.layout.addChild(myVideoView);
}
);
module.exports = Page1;

Usage

iOS provides controller bar for videos unlike Android. You need to add some objects(like button or label) to get the same feature only for Android.

Android Assets

VideoView.loadFile(file) does NOT work for the files under assets folder.

Video continues to play after the page is hidden

You should not forget to call the 'pause' or 'stop' method before the page is hidden.