nstudio / nativescript-audio

:microphone: NativeScript plugin to record and play audio :musical_note:
Other
150 stars 104 forks source link

Property 'playAtTime' does not exist on type 'TNSPlayer' #115

Closed NL33 closed 6 years ago

NL33 commented 6 years ago

I have initialized the player (from url) and am able to get it to play without issue with code like:

this._player.initFromURL({
   audioFile: audioURL,
   loop: false
)}.then(()=>{
 this._player.play()
});

But, if instead of "this._player.play()" I try "this._player.playAtTime()" I get the error: Property 'playAtTime' does not exist on type 'TNSPlayer'

I am on iOS. Just re-downloaded plugin today, and NS version 4.1.0.

NathanWalker commented 6 years ago

@NL33 Try this:

(<any>this._player).playAtTime(...some time...)

This is likely just tsc complaining since playAtTime is not on the published typings: https://github.com/nstudio/nativescript-audio/blob/master/src/index.d.ts

Lemme know. If that solves it for you and works we can update the typings.

NL33 commented 6 years ago

Thanks. That does take care of the error.

When I run (<any>this._player).playAtTime(0) it properly registers: "NativeScript-Audio - TNSPlayer playAtTime,0"

However, it does not play. Same if I enter, say, (<any>this._player).playAtTime(10)

I assume I am just entering the time element incorrectly.