mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-22 10:36:26 +08:00
feat(streaming-media): add streaming media support (#486)
This commit is contained in:
parent
ae03d7237e
commit
841b242fb9
@ -83,6 +83,7 @@ import { SpinnerDialog } from './plugins/spinnerdialog';
|
|||||||
import { Splashscreen } from './plugins/splashscreen';
|
import { Splashscreen } from './plugins/splashscreen';
|
||||||
import { SQLite } from './plugins/sqlite';
|
import { SQLite } from './plugins/sqlite';
|
||||||
import { StatusBar } from './plugins/statusbar';
|
import { StatusBar } from './plugins/statusbar';
|
||||||
|
import { StreamingMedia } from './plugins/streaming-media';
|
||||||
import { ThreeDeeTouch } from './plugins/3dtouch';
|
import { ThreeDeeTouch } from './plugins/3dtouch';
|
||||||
import { Toast } from './plugins/toast';
|
import { Toast } from './plugins/toast';
|
||||||
import { TouchID } from './plugins/touchid';
|
import { TouchID } from './plugins/touchid';
|
||||||
@ -125,6 +126,7 @@ export * from './plugins/push';
|
|||||||
export * from './plugins/safari-view-controller';
|
export * from './plugins/safari-view-controller';
|
||||||
export * from './plugins/sms';
|
export * from './plugins/sms';
|
||||||
export * from './plugins/spinnerdialog';
|
export * from './plugins/spinnerdialog';
|
||||||
|
export * from './plugins/streaming-media';
|
||||||
export * from './plugins/toast';
|
export * from './plugins/toast';
|
||||||
export * from './plugins/twitter-connect';
|
export * from './plugins/twitter-connect';
|
||||||
export * from './plugins/video-editor';
|
export * from './plugins/video-editor';
|
||||||
@ -269,6 +271,7 @@ window['IonicNative'] = {
|
|||||||
Splashscreen: Splashscreen,
|
Splashscreen: Splashscreen,
|
||||||
SQLite: SQLite,
|
SQLite: SQLite,
|
||||||
StatusBar: StatusBar,
|
StatusBar: StatusBar,
|
||||||
|
StreamingMedia: StreamingMedia,
|
||||||
ThreeDeeTouch: ThreeDeeTouch,
|
ThreeDeeTouch: ThreeDeeTouch,
|
||||||
Toast: Toast,
|
Toast: Toast,
|
||||||
TouchID: TouchID,
|
TouchID: TouchID,
|
||||||
|
77
src/plugins/streaming-media.ts
Normal file
77
src/plugins/streaming-media.ts
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import {Plugin, Cordova} from './plugin';
|
||||||
|
/**
|
||||||
|
* @name StreamingMedia
|
||||||
|
* @description
|
||||||
|
* This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```
|
||||||
|
* import {StreamingMedia} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* let options: VideoOptions = {
|
||||||
|
* successCallback: () => { console.log('Video played') },
|
||||||
|
* errorCallback: (e) => { console.log('Error streaming') },
|
||||||
|
* orientation: 'landscape'
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* StreamingMedia.('https://path/to/video/stream', options);
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-streaming-media',
|
||||||
|
pluginRef: 'plugins.streamingMedia',
|
||||||
|
repo: 'https://github.com/nchutchind/cordova-plugin-streaming-media',
|
||||||
|
platforms: ['Android', 'iOS']
|
||||||
|
})
|
||||||
|
export class StreamingMedia {
|
||||||
|
/**
|
||||||
|
* Streams a video
|
||||||
|
* @param videoUrl {string} The URL of the video
|
||||||
|
* @param options {VideoOptions} Options
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static playVideo(videoUrl: string, options?: VideoOptions): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Streams an audio
|
||||||
|
* @param audioUrl {string} The URL of the audio stream
|
||||||
|
* @param options {AudioOptions} Options
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static playAudio(audioUrl: string, options?: AudioOptions): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops streaming audio
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true})
|
||||||
|
static stopAudio(): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pauses streaming audio
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true, platforms: ['iOS']})
|
||||||
|
static pauseAudio(): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resumes streaming audio
|
||||||
|
*/
|
||||||
|
@Cordova({sync: true, platforms: ['iOS']})
|
||||||
|
static resumeAudio(): void { }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VideoOptions {
|
||||||
|
successCallback?: Function;
|
||||||
|
errorCallback?: Function;
|
||||||
|
orientation?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AudioOptions {
|
||||||
|
bgColor?: string;
|
||||||
|
bgImage?: string;
|
||||||
|
bgImageScale?: string;
|
||||||
|
initFullscreen?: boolean;
|
||||||
|
successCallback?: Function;
|
||||||
|
errorCallback?: Function;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user