Skip to content

Commit

Permalink
Merge pull request #18 from bnsuhas/bugfix/stateChangeFix
Browse files Browse the repository at this point in the history
Avoid calling didStateChange on delegate if current player state is same as next state
  • Loading branch information
Andre3567 authored Aug 14, 2024
2 parents 786e9e0 + 1b99da0 commit a0f94bc
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 a0f94bc

Please sign in to comment.