fix(media): nest the constructor logic

This commit is contained in:
Ibrahim Hadeed 2016-09-06 23:02:46 -04:00
parent d03d70ff0b
commit a566240266
No known key found for this signature in database
GPG Key ID: 0431793F665481A4

View File

@ -127,12 +127,11 @@ export class MediaPlugin {
* @param src {string} A URI containing the audio content.
*/
constructor(src: string) {
let res, rej, next;
this.init = new Promise<any>((resolve, reject) => { res = resolve; rej = reject; });
this.status = new Observable((observer) => {
next = data => observer.next(data);
this.init = new Promise<any>((resolve, reject) => {
this.status = new Observable((observer) => {
this._objectInstance = new Media(src, resolve, reject, observer.next.bind(observer));
});
});
this._objectInstance = new Media(src, res, rej, next);
}
/**