Skip to content

Commit

Permalink
Merge pull request #96 from 0dayZh/master
Browse files Browse the repository at this point in the history
Updated to v1.6.2
  • Loading branch information
0dayZh committed Feb 23, 2016
2 parents 1b5dc23 + b11c641 commit e2b0875
Show file tree
Hide file tree
Showing 19 changed files with 291 additions and 42 deletions.
17 changes: 17 additions & 0 deletions APIDiffs/api-diffs-1.6.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# PLCameraStreamingKit 1.6.1 to 1.6.2 API Differences

## General Headers

```
PLCameraSource.h
```

- *Added* property `@property (nonatomic, assign) CGFloat videoZoomFactor;`
- *Added* property `@property (nonatomic, retain) AVCaptureDeviceFormat *videoActiveFormat;`

```
PLCameraStreamingSession.h
```

- *Added* property `@property (nonatomic, assign) CGFloat videoZoomFactor;`
- *Added* property `@property (nonatomic, retain) AVCaptureDeviceFormat *videoActiveFormat;`
24 changes: 17 additions & 7 deletions Example/PLCameraStreamingKit/Base.lproj/Main_iPhone.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1509" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="0aL-3q-s7A">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="14F1605" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="0aL-3q-s7A">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -127,16 +127,16 @@
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="24d-PX-2NR">
<rect key="frame" x="0.0" y="80" width="600" height="448"/>
<rect key="frame" x="20" y="80" width="560" height="448"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="2" translatesAutoresizingMaskIntoConstraints="NO" id="PKp-Bc-QgB">
<rect key="frame" x="217" y="36" width="166" height="29"/>
<rect key="frame" x="225" y="36" width="150" height="29"/>
<constraints>
<constraint firstAttribute="width" constant="166" id="BfM-XD-zBn"/>
<constraint firstAttribute="width" constant="150" id="BfM-XD-zBn"/>
</constraints>
<segments>
<segment title="15fps"/>
Expand All @@ -147,21 +147,30 @@
<action selector="segmentedControlValueDidChange:" destination="vXZ-lx-hvc" eventType="valueChanged" id="X2X-RZ-EsQ"/>
</connections>
</segmentedControl>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="1" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="KXM-sc-ILw">
<rect key="frame" x="18" y="490" width="564" height="31"/>
<connections>
<action selector="zoomSliderValueDidChange:" destination="vXZ-lx-hvc" eventType="valueChanged" id="lY1-rK-K0A"/>
</connections>
</slider>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="24d-PX-2NR" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="60" id="46a-D2-W2c"/>
<constraint firstItem="imY-d4-8r9" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="8" id="AHl-mp-xLh"/>
<constraint firstAttribute="trailingMargin" secondItem="24d-PX-2NR" secondAttribute="trailing" constant="-20" id="AY0-VF-ZvO"/>
<constraint firstAttribute="trailingMargin" secondItem="24d-PX-2NR" secondAttribute="trailing" id="AY0-VF-ZvO"/>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="23g-Fm-A4B" secondAttribute="bottom" constant="20" id="Bz4-XN-MtS"/>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="rft-Nr-a9A" secondAttribute="bottom" constant="20" id="G1E-5f-oYS"/>
<constraint firstItem="rft-Nr-a9A" firstAttribute="trailing" secondItem="kh9-bI-dsS" secondAttribute="trailingMargin" id="Gkh-VQ-pVC"/>
<constraint firstItem="qYA-qU-D3h" firstAttribute="top" secondItem="KXM-sc-ILw" secondAttribute="bottom" constant="16" id="MHN-6q-AFd"/>
<constraint firstItem="KXM-sc-ILw" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="Pf2-mB-z42"/>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="24d-PX-2NR" secondAttribute="bottom" constant="72" id="ScA-L2-OaP"/>
<constraint firstItem="O35-P7-T0e" firstAttribute="trailing" secondItem="kh9-bI-dsS" secondAttribute="trailingMargin" id="Ve0-ob-57R"/>
<constraint firstItem="24d-PX-2NR" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="-20" id="Zzf-qk-AhJ"/>
<constraint firstItem="24d-PX-2NR" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="Zzf-qk-AhJ"/>
<constraint firstAttribute="centerX" secondItem="qYA-qU-D3h" secondAttribute="centerX" id="dVY-Mb-fna"/>
<constraint firstItem="23g-Fm-A4B" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="psL-mu-8kS"/>
<constraint firstItem="O35-P7-T0e" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="8" id="r6k-zK-YQt"/>
<constraint firstAttribute="leadingMargin" secondItem="KXM-sc-ILw" secondAttribute="leading" id="rbs-RJ-UA7"/>
<constraint firstItem="PKp-Bc-QgB" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="sNC-4a-3gs"/>
<constraint firstItem="PKp-Bc-QgB" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="16" id="xaE-DG-8w5"/>
<constraint firstItem="imY-d4-8r9" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="-4" id="yNq-YN-Xwk"/>
Expand All @@ -175,6 +184,7 @@
<outlet property="textView" destination="24d-PX-2NR" id="TiM-CW-3VE"/>
<outlet property="toggleCameraButton" destination="23g-Fm-A4B" id="bFE-st-cCr"/>
<outlet property="torchButton" destination="rft-Nr-a9A" id="TMn-Zv-Dl6"/>
<outlet property="zoomSlider" destination="KXM-sc-ILw" id="uHS-e8-Pwg"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
Expand Down
5 changes: 5 additions & 0 deletions Example/PLCameraStreamingKit/PLCameraStreamingKit-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
@property (weak, nonatomic) IBOutlet UIButton *muteButton;
@property (weak, nonatomic) IBOutlet UITextView *textView;
@property (weak, nonatomic) IBOutlet UISegmentedControl *segementedControl;
@property (weak, nonatomic) IBOutlet UISlider *zoomSlider;

- (IBAction)segmentedControlValueDidChange:(id)sender;
- (IBAction)zoomSliderValueDidChange:(id)sender;

@end
40 changes: 28 additions & 12 deletions Example/PLCameraStreamingKit/PLCameraStreamingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ - (void)viewDidLoad {
self.session.bufferDelegate = self;
dispatch_async(dispatch_get_main_queue(), ^{
self.session.previewView = self.view;
self.zoomSlider.minimumValue = 1;
self.zoomSlider.maximumValue = self.session.videoActiveFormat.videoMaxZoomFactor;

NSString *log = [NSString stringWithFormat:@"Zoom Range: [1..%.0f]", self.session.videoActiveFormat.videoMaxZoomFactor];
NSLog(@"%@", log);
self.textView.text = [NSString stringWithFormat:@"%@\%@", self.textView.text, log];
});
});
};
Expand Down Expand Up @@ -185,27 +191,31 @@ - (void)reachabilityChanged:(NSNotification *)notif{
[self stopSession];
}

NSLog(@"Networkt Status: %s", networkStatus[status]);
self.textView.text = LogString();
NSString *log = [NSString stringWithFormat:@"Networkt Status: %s", networkStatus[status]];
NSLog(@"%@", log);
self.textView.text = [NSString stringWithFormat:@"%@\%@", self.textView.text, log];
}

#pragma mark - <PLStreamingSendingBufferDelegate>

- (void)streamingSessionSendingBufferDidFull:(id)session {
NSLog(@"Buffer is full");
self.textView.text = LogString();
NSString *log = @"Buffer is full";
NSLog(@"%@", log);
self.textView.text = [NSString stringWithFormat:@"%@\%@", self.textView.text, log];
}

- (void)streamingSession:(id)session sendingBufferDidDropItems:(NSArray *)items {
NSLog(@"Frame dropped");
self.textView.text = LogString();
NSString *log = @"Frame dropped";
NSLog(@"%@", log);
self.textView.text = [NSString stringWithFormat:@"%@\%@", self.textView.text, log];
}

#pragma mark - <PLCameraStreamingSessionDelegate>

- (void)cameraStreamingSession:(PLCameraStreamingSession *)session streamStateDidChange:(PLStreamState)state {
NSLog(@"Stream State: %s", stateNames[state]);
self.textView.text = LogString();
NSString *log = [NSString stringWithFormat:@"Stream State: %s", stateNames[state]];
NSLog(@"%@", log);
self.textView.text = [NSString stringWithFormat:@"%@\%@", self.textView.text, log];

// 除 PLStreamStateError 外的其余状态会回调在这个方法
// 这个回调会确保在主线程,所以可以直接对 UI 做操作
Expand All @@ -217,17 +227,19 @@ - (void)cameraStreamingSession:(PLCameraStreamingSession *)session streamStateDi
}

- (void)cameraStreamingSession:(PLCameraStreamingSession *)session didDisconnectWithError:(NSError *)error {
NSLog(@"Stream State: Error. %@", error);
self.textView.text = LogString();
NSString *log = [NSString stringWithFormat:@"Stream State: Error. %@", error];
NSLog(@"%@", log);
self.textView.text = [NSString stringWithFormat:@"%@\%@", self.textView.text, log];
// PLStreamStateError 都会回调在这个方法
// 尝试重连,注意这里需要你自己来处理重连尝试的次数以及重连的时间间隔
[self.actionButton setTitle:NSLocalizedString(@"Reconnecting", nil) forState:UIControlStateNormal];
[self startSession];
}

- (void)cameraStreamingSession:(PLCameraStreamingSession *)session streamStatusDidUpdate:(PLStreamStatus *)status {
NSLog(@"%@", status);
self.textView.text = LogString();
NSString *log = [NSString stringWithFormat:@"%@", status];
NSLog(@"%@", log);
self.textView.text = [NSString stringWithFormat:@"%@\%@", self.textView.text, log];

#if kReloadConfigurationEnable
NSDate *now = [NSDate date];
Expand Down Expand Up @@ -304,6 +316,10 @@ - (IBAction)segmentedControlValueDidChange:(id)sender {
[self.session reloadVideoConfiguration:config];
}

- (IBAction)zoomSliderValueDidChange:(id)sender {
self.session.videoZoomFactor = self.zoomSlider.value;
}

- (IBAction)actionButtonPressed:(id)sender {
if (PLStreamStateConnected == self.session.streamState) {
[self stopSession];
Expand Down
14 changes: 7 additions & 7 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PODS:
- HappyDNS (0.2.3)
- PLCameraStreamingKit (1.6.1):
- PLStreamingKit (~> 1.1.3)
- PLStreamingKit (1.1.3):
- PLCameraStreamingKit (1.6.2):
- PLStreamingKit (~> 1.1.5)
- PLStreamingKit (1.1.5):
- HappyDNS
- PLStreamingKit/precompiled (= 1.1.3)
- PLStreamingKit/precompiled (1.1.3):
- PLStreamingKit/precompiled (= 1.1.5)
- PLStreamingKit/precompiled (1.1.5):
- HappyDNS

DEPENDENCIES:
Expand All @@ -17,7 +17,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
HappyDNS: 6d85942e64c28b4fa61f8c76580398f52d6d1d11
PLCameraStreamingKit: df7c55ad9527dc83bff75ae077aa9a9afec996c6
PLStreamingKit: 4ce7abd3688c4e6767b4ac83a813bd785a2c1748
PLCameraStreamingKit: a17ac88c71ee84ebf148d7c4c1be843dbb9da2d6
PLStreamingKit: 3792348c354af2271629eeb154e0e83774f34c07

COCOAPODS: 0.39.0
6 changes: 3 additions & 3 deletions Example/Pods/Local Podspecs/PLCameraStreamingKit.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e2b0875

Please sign in to comment.