Commit 08976f1e authored by Carola Nitz's avatar Carola Nitz

VLCMovieViewController: adjust activityIndicator behavior

* position indicator in the middle of the movieViewController
* simplify state code and only show the indicator for buffering when we are not in paused mode before
since we never get an event that we're done with buffering (closes #306)

(cherry picked from commit 3ab2728b)
parent 8c80e666
......@@ -97,10 +97,10 @@
<color key="shadowColor" red="1" green="1" blue="1" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</label>
<activityIndicatorView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" misplaced="YES" style="whiteLarge" id="vR5-i9-KEJ">
<rect key="frame" x="169" y="373" width="37" height="37"/>
<rect key="frame" x="170" y="316" width="37" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
<view hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" id="108" userLabel="Playing Externally View" customClass="VLCPlayingExternallyView" customModule="VLC_iOS" customModuleProvider="target">
<view hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" id="108" userLabel="Playing Externally View" customClass="VLCPlayingExternallyView" customModule="VLC" customModuleProvider="target">
<rect key="frame" x="28" y="178" width="320" height="257"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
......
......@@ -81,6 +81,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
BOOL _playbackWillClose;
BOOL _isTapSeeking;
VLCMovieJumpState _previousJumpState;
VLCMediaPlayerState _previousPlayerStateWasPaused;
UIPinchGestureRecognizer *_pinchRecognizer;
VLCPanType _currentPanType;
......@@ -778,21 +779,15 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[self setControlsHidden:!_controlsHidden animated:YES];
}
- (void)updateActivityIndicatorForState:(VLCMediaPlayerState)state {
UIActivityIndicatorView *indicator = self.activityIndicator;
switch (state) {
case VLCMediaPlayerStateBuffering:
if (!indicator.isAnimating) {
self.activityIndicator.alpha = 1.0;
[self.activityIndicator startAnimating];
}
break;
default:
if (indicator.isAnimating) {
[self.activityIndicator stopAnimating];
self.activityIndicator.alpha = 0.0;
}
break;
- (void)updateActivityIndicatorForState:(VLCMediaPlayerState)state
{
if (state == VLCMediaPlayerStatePlaying || state == VLCMediaPlayerStatePaused) {
_previousPlayerStateWasPaused = state == VLCMediaPlayerStatePaused;
}
BOOL shouldAnimate = state == VLCMediaPlayerStateBuffering && !_previousPlayerStateWasPaused;
if (self.activityIndicator.isAnimating != shouldAnimate) {
self.activityIndicator.alpha = shouldAnimate ? 1.0 : 0.0;
shouldAnimate ? [self.activityIndicator startAnimating] : [self.activityIndicator stopAnimating];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment