UNPKG

1.67 kBTypeScriptView Raw
1/**
2 * Options for the video playback using the `play` function.
3 */
4export interface VideoOptions {
5 /**
6 * Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%.
7 * For example: for a volume of 30% set the value to 0.3.
8 */
9 volume?: number;
10 /**
11 * There are to options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING.
12 * These strings are the only ones which can be passed as option.
13 */
14 scalingMode?: number;
15}
16/**
17 * @name VideoPlayer
18 * @description
19 * A Codova plugin that simply allows you to immediately play a video in fullscreen mode.
20 *
21 * Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer).
22 *
23 * @usage
24 * ```typescript
25 * import { VideoPlayer } from 'ionic-native';
26 *
27 *
28 * // Playing a video.
29 * VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
30 * console.log('video completed');
31 * }).catch(err => {
32 * console.log(err);
33 * });
34 *
35 * ```
36 * @interfaces
37 * VideoOptions
38 */
39export declare class VideoPlayer {
40 /**
41 * Plays the video from the passed url.
42 * @param fileUrl {string} File url to the video.
43 * @param options {VideoOptions?} Optional video playback settings. See options above.
44 * @returns {Promise<any>} Resolves promise when the video was played successfully.
45 */
46 static play(fileUrl: string, options?: VideoOptions): Promise<any>;
47 /**
48 * Stops the video playback immediatly.
49 */
50 static close(): void;
51}