mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-16 08:21:10 +08:00
feat(video-player): Added video player plugin (#391)
* Added OneSignal wrapper * documentation * Changes for callback of notification revieced * fixes for @Cordova decorators without Promise return * Merge * Improvements to OneSignal extended init function with notificationOpenedCallback as an optional parameter * Platforms removed OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms. * Init method turned into observable * Screen Orientation Plugin added. Closes #342 * Added VideoPlayer plugin #318
This commit is contained in:
parent
9d03a6009b
commit
cabeeb8dab
@ -79,6 +79,7 @@ import {Toast} from './plugins/toast';
|
|||||||
import {TouchID} from './plugins/touchid';
|
import {TouchID} from './plugins/touchid';
|
||||||
import {TwitterConnect} from './plugins/twitter-connect';
|
import {TwitterConnect} from './plugins/twitter-connect';
|
||||||
import {Vibration} from './plugins/vibration';
|
import {Vibration} from './plugins/vibration';
|
||||||
|
import {VideoPlayer} from './plugins/video-player';
|
||||||
import {WebIntent} from './plugins/webintent';
|
import {WebIntent} from './plugins/webintent';
|
||||||
export * from './plugins/3dtouch';
|
export * from './plugins/3dtouch';
|
||||||
export * from './plugins/background-geolocation';
|
export * from './plugins/background-geolocation';
|
||||||
@ -111,6 +112,7 @@ export * from './plugins/sms';
|
|||||||
export * from './plugins/spinnerdialog';
|
export * from './plugins/spinnerdialog';
|
||||||
export * from './plugins/toast';
|
export * from './plugins/toast';
|
||||||
export * from './plugins/twitter-connect';
|
export * from './plugins/twitter-connect';
|
||||||
|
export * from './plugins/video-player';
|
||||||
export {
|
export {
|
||||||
ActionSheet,
|
ActionSheet,
|
||||||
AdMob,
|
AdMob,
|
||||||
@ -238,6 +240,7 @@ window['IonicNative'] = {
|
|||||||
TouchID: TouchID,
|
TouchID: TouchID,
|
||||||
Transfer: Transfer,
|
Transfer: Transfer,
|
||||||
TwitterConnect: TwitterConnect,
|
TwitterConnect: TwitterConnect,
|
||||||
|
VideoPlayer: VideoPlayer,
|
||||||
Vibration: Vibration,
|
Vibration: Vibration,
|
||||||
WebIntent: WebIntent
|
WebIntent: WebIntent
|
||||||
};
|
};
|
||||||
|
62
src/plugins/video-player.ts
Normal file
62
src/plugins/video-player.ts
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the video playback using the `play` function.
|
||||||
|
*/
|
||||||
|
export interface VideoOptions {
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
volume?: 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.
|
||||||
|
*/
|
||||||
|
scalingMode?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name VideoPlayer
|
||||||
|
* @description
|
||||||
|
* 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](https://github.com/moust/cordova-plugin-videoplayer).
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { VideoPlayer } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* // Playing a video.
|
||||||
|
* VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
|
||||||
|
* console.log('video completed');
|
||||||
|
* }).catch(err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-videoplayer',
|
||||||
|
pluginRef: 'VideoPlayer',
|
||||||
|
repo: 'https://github.com/moust/cordova-plugin-videoplayer',
|
||||||
|
platforms: ['Android']
|
||||||
|
})
|
||||||
|
export class VideoPlayer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays the video from the passed url.
|
||||||
|
* @param fileUrl {string} File url to the video.
|
||||||
|
* @param options {VideoOptions?} Optional video playback settings. See options above.
|
||||||
|
* @returns {Promise<any>} Resolves promise when the video was played successfully.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static play(fileUrl: string, options?: VideoOptions): Promise<any> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the video playback immediatly.
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static close(): void { }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user