mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[ASVideoNode] Addition of reset method to return to initial state (#2119)
* [ASVideoNode] Addition of reset method to allow video node to return to initial state of placeholder and play button * Implemented pull request review comments for code style
This commit is contained in:
@@ -39,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)play;
|
- (void)play;
|
||||||
- (void)pause;
|
- (void)pause;
|
||||||
- (BOOL)isPlaying;
|
- (BOOL)isPlaying;
|
||||||
|
- (void)resetToPlaceholder;
|
||||||
|
|
||||||
@property (nullable, nonatomic, strong, readwrite) AVAsset *asset;
|
@property (nullable, nonatomic, strong, readwrite) AVAsset *asset;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -671,6 +671,19 @@ static NSString * const kRate = @"rate";
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)resetToPlaceholder
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
|
||||||
|
if (_playerNode != nil) {
|
||||||
|
[_playerNode removeFromSupernode];
|
||||||
|
_playerNode = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
[_player seekToTime:kCMTimeZero];
|
||||||
|
[self pause];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Playback observers
|
#pragma mark - Playback observers
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)play;
|
- (void)play;
|
||||||
- (void)pause;
|
- (void)pause;
|
||||||
- (BOOL)isPlaying;
|
- (BOOL)isPlaying;
|
||||||
|
- (void)resetToPlaceholder;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -668,6 +668,11 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
|||||||
return [_videoNode isPlaying];
|
return [_videoNode isPlaying];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)resetToPlaceholder
|
||||||
|
{
|
||||||
|
[_videoNode resetToPlaceholder];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray *)controlsForLayoutSpec
|
- (NSArray *)controlsForLayoutSpec
|
||||||
{
|
{
|
||||||
NSMutableArray *controls = [[NSMutableArray alloc] initWithCapacity:_cachedControls.count];
|
NSMutableArray *controls = [[NSMutableArray alloc] initWithCapacity:_cachedControls.count];
|
||||||
|
|||||||
Reference in New Issue
Block a user