Video Player

Improve this doc

$ ionic plugin add https://github.com/moust/cordova-plugin-videoplayer
$ npm install --save @ionic-native/video-player

Repo: https://github.com/moust/cordova-plugin-videoplayer

A Codova plugin that simply allows you to immediately play a video in fullscreen mode.

Requires Cordova plugin: com.moust.cordova.videoplayer. For more info, please see the VideoPlayer plugin docs.

Supported platforms

Usage

import { VideoPlayer } from '@ionic-native/video-player';

constructor(private videoPlayer: VideoPlayer) { }

...

// Playing a video.
this.videoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
 console.log('video completed');
}).catch(err => {
 console.log(err);
});

Instance Members

play(fileUrl, options)

Plays the video from the passed url.

Param Type Details
fileUrl string

File url to the video.

options VideoOptions

Optional video playback settings. See options above.

Returns: Promise<any> Resolves promise when the video was played successfully.

close()

Stops the video playback immediatly.

VideoOptions

Param Type Details
volume number

Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%. For example: for a volume of 30% set the value to 0.3.

(optional)
scalingMode number

There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING. These strings are the only ones which can be passed as option.

(optional)

API

Native

General