Skip to content

Commit b337287

Browse files
authored
iOS: Resolve promises when calling play, pause or seekTo (#184)
Previously when calling the play, pause or seekTo methods when running on iOS and the player was not in the expected state, the Promise would never be resolved. e.g. this line would never complete if already in the playing state: await player.play()
1 parent 1acff7b commit b337287

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ios/player.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ export class TNSPlayer extends Observable implements TNSPlayerI {
279279
try {
280280
if (this._player && this._player.playing) {
281281
this._player.pause();
282-
resolve(true);
283282
}
283+
resolve(true);
284284
} catch (ex) {
285285
if (this.errorCallback) {
286286
this.errorCallback({ ex });
@@ -295,8 +295,8 @@ export class TNSPlayer extends Observable implements TNSPlayerI {
295295
try {
296296
if (!this.isAudioPlaying()) {
297297
this._player.play();
298-
resolve(true);
299298
}
299+
resolve(true);
300300
} catch (ex) {
301301
if (this.errorCallback) {
302302
this.errorCallback({ ex });
@@ -323,8 +323,8 @@ export class TNSPlayer extends Observable implements TNSPlayerI {
323323
try {
324324
if (this._player) {
325325
this._player.currentTime = time;
326-
resolve(true);
327326
}
327+
resolve(true);
328328
} catch (ex) {
329329
reject(ex);
330330
}

0 commit comments

Comments
 (0)