Skip to content

Commit

Permalink
bugfix: Avoid calling didStateChange on delegate is current player st…
Browse files Browse the repository at this point in the history
…ate is same as next state
  • Loading branch information
bnsuhas committed Aug 13, 2024
1 parent 786e9e0 commit 1b99da0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TritonPlayerSDK/Classes/Player/TritonPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,10 @@ -(void)updateStateMachineForAction:(TDPlayerAction)action {
TDPlayerState nextState = [self nextStateForAction:action];

// If state changed, send the delegate a callback message
if (self.state != nextState) {
self.state = nextState;

PLAYER_LOG(@"Changed state to: %@", [TritonPlayer toStringState:self.state]);
PLAYER_LOG(@"Changed state to: %@", [TritonPlayer toStringState:self.state]);

// Clear error
if (self.state != kTDPlayerStateError) {
Expand All @@ -664,6 +665,7 @@ -(void)updateStateMachineForAction:(TDPlayerAction)action {
[self.delegate player:self didChangeState:self.state];
});
}
}
}

+(NSString*) toStringState:(TDPlayerState)state
Expand Down

0 comments on commit 1b99da0

Please sign in to comment.