Skip to content

Commit

Permalink
- Modified TritonPlayer class to set allowExternalPlayback property i…
Browse files Browse the repository at this point in the history
…n startInThread method after mediaPlayer is initialised

- Fixed method name typo in TDStreamPlayer class
  • Loading branch information
bnsuhas committed Jul 20, 2021
1 parent 9a4f2f1 commit cb5e9cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion TritonPlayerSDK/Classes/Player/TDStreamPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ -(void)seekToTime:(CMTime)time completionHandler:(void (^)(BOOL))completionHandl
}
}

- (void)allowsExternalPlayback:(BOOL)allow {
- (void)setAllowsExternalPlayback:(BOOL)allow {

if ([self.player respondsToSelector:@selector(setAllowsExternalPlayback:)]) {
[self.player setAllowsExternalPlayback:allow];
Expand Down
5 changes: 5 additions & 0 deletions TritonPlayerSDK/Classes/Player/TritonPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ @interface TritonPlayer() <CLLocationManagerDelegate, TDMediaPlaybackDelegate>
@property (nonatomic, strong) NSTimer *playDebouncingTimer;
@property (nonatomic, strong) NSOperationQueue *playerOperationQueue;

//Using a property to store the external playback setting because the mediaPlayer instance will be nil when play method is called.
@property (nonatomic, assign) BOOL shouldAllowExternalPlayback;

@end

@implementation TritonPlayer
Expand Down Expand Up @@ -333,6 +336,8 @@ - (void)startInThread {
}

[self.mediaPlayer play];
//Set the allowsExternalPlayback flag for the current media player if it's supported.
[self.mediaPlayer setAllowsExternalPlayback: self.shouldAllowExternalPlayback];

[[NSRunLoop currentRunLoop] addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode];
while (_active) {
Expand Down

0 comments on commit cb5e9cd

Please sign in to comment.