mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-04-13 00:00:10 +08:00
chore(package): bump dependencies and lint rules
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin, InstanceProperty } from '@ionic-native/core';
|
||||
import {
|
||||
checkAvailability,
|
||||
CordovaInstance,
|
||||
InstanceProperty,
|
||||
IonicNativePlugin,
|
||||
Plugin
|
||||
} from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
|
||||
@@ -7,7 +13,6 @@ import { Observer } from 'rxjs/Observer';
|
||||
* @hidden
|
||||
*/
|
||||
export class MediaObject {
|
||||
|
||||
/**
|
||||
* An observable that notifies you on actions success
|
||||
*/
|
||||
@@ -26,36 +31,37 @@ export class MediaObject {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@InstanceProperty
|
||||
successCallback: Function;
|
||||
@InstanceProperty successCallback: Function;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@InstanceProperty
|
||||
errorCallback: Function;
|
||||
@InstanceProperty errorCallback: Function;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@InstanceProperty
|
||||
statusCallback: Function;
|
||||
@InstanceProperty statusCallback: Function;
|
||||
|
||||
constructor(private _objectInstance: any) {
|
||||
this.onSuccess = new Observable<any>((observer: Observer<any>) => {
|
||||
this.successCallback = observer.next.bind(observer);
|
||||
return () => this.successCallback = () => {};
|
||||
return () => (this.successCallback = () => {});
|
||||
});
|
||||
|
||||
this.onError = new Observable<MEDIA_ERROR>((observer: Observer<MEDIA_ERROR>) => {
|
||||
this.errorCallback = observer.next.bind(observer);
|
||||
return () => this.errorCallback = () => {};
|
||||
});
|
||||
this.onError = new Observable<MEDIA_ERROR>(
|
||||
(observer: Observer<MEDIA_ERROR>) => {
|
||||
this.errorCallback = observer.next.bind(observer);
|
||||
return () => (this.errorCallback = () => {});
|
||||
}
|
||||
);
|
||||
|
||||
this.onStatusUpdate = new Observable<MEDIA_STATUS>((observer: Observer<MEDIA_STATUS>) => {
|
||||
this.statusCallback = observer.next.bind(observer);
|
||||
return () => this.statusCallback = () => {};
|
||||
});
|
||||
this.onStatusUpdate = new Observable<MEDIA_STATUS>(
|
||||
(observer: Observer<MEDIA_STATUS>) => {
|
||||
this.statusCallback = observer.next.bind(observer);
|
||||
return () => (this.statusCallback = () => {});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,56 +69,62 @@ export class MediaObject {
|
||||
* @returns {Promise<any>} Returns a promise with the amplitude of the current recording
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getCurrentAmplitude(): Promise<any> { return; }
|
||||
getCurrentAmplitude(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current position within an audio file. Also updates the Media object's position parameter.
|
||||
* @returns {Promise<any>} Returns a promise with the position of the current recording
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getCurrentPosition(): Promise<any> { return; }
|
||||
getCurrentPosition(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
|
||||
* @returns {number} Returns a promise with the duration of the current recording
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getDuration(): number { return; }
|
||||
getDuration(): number {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts or resumes playing an audio file.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
play(iosOptions?: {
|
||||
numberOfLoops?: number,
|
||||
playAudioWhenScreenIsLocked?: boolean
|
||||
}): void { }
|
||||
numberOfLoops?: number;
|
||||
playAudioWhenScreenIsLocked?: boolean;
|
||||
}): void {}
|
||||
|
||||
/**
|
||||
* Pauses playing an audio file.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
pause(): void { }
|
||||
pause(): void {}
|
||||
|
||||
/**
|
||||
* Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
release(): void { }
|
||||
release(): void {}
|
||||
|
||||
/**
|
||||
* Sets the current position within an audio file.
|
||||
* @param {number} milliseconds The time position you want to set for the current audio file
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
seekTo(milliseconds: number): void { }
|
||||
seekTo(milliseconds: number): void {}
|
||||
|
||||
/**
|
||||
* Set the volume for an audio file.
|
||||
* @param volume {number} The volume to set for playback. The value must be within the range of 0.0 to 1.0.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setVolume(volume: number): void { }
|
||||
setVolume(volume: number): void {}
|
||||
|
||||
@CordovaInstance({ sync: true })
|
||||
setRate(speedRate: number): void {}
|
||||
@@ -121,38 +133,36 @@ export class MediaObject {
|
||||
* Starts recording an audio file.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
startRecord(): void { }
|
||||
startRecord(): void {}
|
||||
|
||||
/**
|
||||
* Stops recording
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
stopRecord(): void { }
|
||||
stopRecord(): void {}
|
||||
|
||||
/**
|
||||
* Pauses recording
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
pauseRecord(): void { }
|
||||
pauseRecord(): void {}
|
||||
|
||||
/**
|
||||
* Resumes recording
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
resumeRecord(): void { }
|
||||
resumeRecord(): void {}
|
||||
|
||||
/**
|
||||
* Stops playing an audio file.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
stop(): void { }
|
||||
|
||||
stop(): void {}
|
||||
}
|
||||
|
||||
export type MediaStatusUpdateCallback = (statusCode: number) => void;
|
||||
|
||||
export interface MediaError {
|
||||
|
||||
/**
|
||||
* Error message
|
||||
*/
|
||||
@@ -162,7 +172,6 @@ export interface MediaError {
|
||||
* Error code
|
||||
*/
|
||||
code: number;
|
||||
|
||||
}
|
||||
|
||||
export enum MEDIA_STATUS {
|
||||
@@ -288,7 +297,6 @@ export type MediaErrorCallback = (error: MediaError) => void;
|
||||
})
|
||||
@Injectable()
|
||||
export class Media extends IonicNativePlugin {
|
||||
|
||||
// Constants
|
||||
/**
|
||||
* @hidden
|
||||
@@ -337,12 +345,14 @@ export class Media extends IonicNativePlugin {
|
||||
create(src: string): MediaObject {
|
||||
let instance: any;
|
||||
|
||||
if (checkAvailability(Media.getPluginRef(), null, Media.getPluginName()) === true) {
|
||||
if (
|
||||
checkAvailability(Media.getPluginRef(), null, Media.getPluginName()) ===
|
||||
true
|
||||
) {
|
||||
// Creates a new media object
|
||||
instance = new (Media.getPlugin())(src);
|
||||
}
|
||||
|
||||
return new MediaObject(instance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user