diff --git a/package.json b/package.json index 6235e1b..065536e 100644 --- a/package.json +++ b/package.json @@ -48,10 +48,7 @@ "bugs": { "url": "https://github.com/bradmartin/nativescript-audio/issues" }, - "license": { - "type": "MIT", - "url": "https://github.com/bradmartin/nativescript-audio/blob/master/LICENSE" - }, + "license": "MIT", "homepage": "https://github.com/bradmartin/nativescript-audio", "readmeFilename": "README.md", "devDependencies": { diff --git a/src/android/player.ts b/src/android/player.ts index 111136e..ee36d46 100644 --- a/src/android/player.ts +++ b/src/android/player.ts @@ -1,6 +1,6 @@ -import {isString} from 'utils/types'; -import {TNSPlayerI} from '../common'; -import {AudioPlayerOptions} from '../options'; +import { isString } from 'utils/types'; +import { TNSPlayerI } from '../common'; +import { AudioPlayerOptions } from '../options'; import * as app from 'application'; import * as utils from 'utils/utils'; import * as fs from 'file-system'; @@ -220,4 +220,8 @@ export class TNSPlayer implements TNSPlayerI { } }); } + + public get currentTime(): number { + return this.player ? this.player.getCurrentPosition() : 0; + } } \ No newline at end of file diff --git a/src/ios/player.ts b/src/ios/player.ts index cd02c9a..975246a 100644 --- a/src/ios/player.ts +++ b/src/ios/player.ts @@ -1,15 +1,15 @@ import * as app from 'application'; -import {isString} from 'utils/types'; -import {knownFolders, path} from 'file-system'; -import {TNSPlayerI} from '../common'; -import {AudioPlayerOptions} from '../options'; +import { isString } from 'utils/types'; +import { knownFolders, path } from 'file-system'; +import { TNSPlayerI } from '../common'; +import { AudioPlayerOptions } from '../options'; var utils = require('utils/utils'); declare var NSURLSession, AVAudioPlayer, NSURL, AVAudioPlayerDelegate; export class TNSPlayer extends NSObject implements TNSPlayerI { public static ObjCProtocols = [AVAudioPlayerDelegate]; - private _player: any; + private _player: AVAudioPlayer; private _task: any; private _completeCallback: any; private _errorCallback: any; @@ -190,4 +190,8 @@ export class TNSPlayer extends NSObject implements TNSPlayerI { this._task = undefined; } } + + public get currentTime(): number { + return this._player ? this._player.currentTime : 0; + } }