萤石云 iOSSDK,移植跨平台相关工程
Davin
2023-06-20 24cb5f1e93b77b744ab702d6a75c6d6b94bbf359
faeture 视频回放横屏适配
3个文件已修改
95 ■■■■■ 已修改文件
EZDemo/HDLEZDemo/HDLEZDemo/EZMain.storyboard 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK/EZSDK/EZ/UIViewControllers/EZPlaybackViewController.m 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZDemo/HDLEZDemo/HDLEZDemo/EZMain.storyboard
@@ -1623,7 +1623,7 @@
                                        </connections>
                                    </button>
                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ruu-Hg-3Tx">
                                        <rect key="frame" x="0.0" y="0.0" width="34" height="20"/>
                                        <rect key="frame" x="20" y="0.0" width="34" height="20"/>
                                        <constraints>
                                            <constraint firstAttribute="height" constant="20" id="0Xh-uc-DaE"/>
                                        </constraints>
@@ -1632,7 +1632,7 @@
                                        <nil key="highlightedColor"/>
                                    </label>
                                    <slider opaque="NO" contentMode="scaleToFill" semanticContentAttribute="playback" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="e5d-g8-Knj">
                                        <rect key="frame" x="35.5" y="-5" width="303.5" height="31"/>
                                        <rect key="frame" x="55.5" y="-5" width="263.5" height="31"/>
                                        <constraints>
                                            <constraint firstAttribute="height" constant="30" id="4zL-xp-G9T"/>
                                        </constraints>
@@ -1642,7 +1642,7 @@
                                        </connections>
                                    </slider>
                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ESG-x4-J8R">
                                        <rect key="frame" x="341" y="0.0" width="34" height="20"/>
                                        <rect key="frame" x="321" y="0.0" width="34" height="20"/>
                                        <constraints>
                                            <constraint firstAttribute="height" constant="20" id="2SN-fe-EDR"/>
                                        </constraints>
@@ -1678,7 +1678,7 @@
                                <constraints>
                                    <constraint firstItem="Z3E-1u-wEn" firstAttribute="leading" secondItem="buq-PS-h5p" secondAttribute="leading" id="1R2-0e-zLb"/>
                                    <constraint firstItem="t6K-Cq-gMh" firstAttribute="leading" secondItem="Z3E-1u-wEn" secondAttribute="trailing" id="4m4-IR-mc0"/>
                                    <constraint firstItem="ruu-Hg-3Tx" firstAttribute="leading" secondItem="buq-PS-h5p" secondAttribute="leading" id="7Mx-RJ-l3f"/>
                                    <constraint firstItem="ruu-Hg-3Tx" firstAttribute="leading" secondItem="buq-PS-h5p" secondAttribute="leading" constant="20" id="7Mx-RJ-l3f"/>
                                    <constraint firstAttribute="bottom" secondItem="7aB-y0-gtH" secondAttribute="bottom" id="7tH-jm-Tc8"/>
                                    <constraint firstItem="7aB-y0-gtH" firstAttribute="leading" secondItem="gRk-Pf-zJ6" secondAttribute="trailing" constant="5" id="8Ex-wx-3ye"/>
                                    <constraint firstItem="ruu-Hg-3Tx" firstAttribute="top" secondItem="buq-PS-h5p" secondAttribute="top" id="Er7-IE-Hng"/>
@@ -1693,7 +1693,7 @@
                                    <constraint firstAttribute="bottom" secondItem="gRk-Pf-zJ6" secondAttribute="bottom" constant="10" id="pO2-v2-n1y"/>
                                    <constraint firstItem="e5d-g8-Knj" firstAttribute="centerY" secondItem="ESG-x4-J8R" secondAttribute="centerY" id="pTj-gC-TCd"/>
                                    <constraint firstAttribute="height" constant="60" id="tMQ-jL-rdi"/>
                                    <constraint firstAttribute="trailing" secondItem="ESG-x4-J8R" secondAttribute="trailing" id="vMR-I6-RPC"/>
                                    <constraint firstAttribute="trailing" secondItem="ESG-x4-J8R" secondAttribute="trailing" constant="20" id="vMR-I6-RPC"/>
                                    <constraint firstAttribute="trailing" secondItem="7aB-y0-gtH" secondAttribute="trailing" id="vXW-8l-Y0i"/>
                                </constraints>
                            </view>
@@ -1790,7 +1790,6 @@
                        </subviews>
                        <color key="backgroundColor" red="0.94117647059999998" green="0.94117647059999998" blue="0.94509803920000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                        <constraints>
                            <constraint firstItem="3j6-e7-ztE" firstAttribute="top" secondItem="buq-PS-h5p" secondAttribute="bottom" id="3Mc-Kc-zIp"/>
                            <constraint firstItem="kQU-Pc-qqv" firstAttribute="leading" secondItem="6jg-tf-s0b" secondAttribute="leading" id="3Sz-uF-O8o"/>
                            <constraint firstItem="ihF-af-cva" firstAttribute="top" secondItem="0R4-Gk-cpw" secondAttribute="bottom" constant="10" id="4k9-qQ-Y1T"/>
                            <constraint firstItem="hY1-Ac-Oot" firstAttribute="top" secondItem="0R4-Gk-cpw" secondAttribute="bottom" id="9Ug-e9-Uoo"/>
@@ -1813,6 +1812,7 @@
                            <constraint firstAttribute="trailing" secondItem="ihF-af-cva" secondAttribute="trailing" constant="10" id="mtn-nO-5qu"/>
                            <constraint firstAttribute="trailing" secondItem="buq-PS-h5p" secondAttribute="trailing" id="qAj-RS-bdT"/>
                            <constraint firstItem="3j6-e7-ztE" firstAttribute="top" secondItem="kQU-Pc-qqv" secondAttribute="bottom" id="tGf-lM-bPe"/>
                            <constraint firstItem="buq-PS-h5p" firstAttribute="bottom" secondItem="kQU-Pc-qqv" secondAttribute="bottom" id="w1f-hD-qgK"/>
                            <constraint firstItem="SJH-Sa-TMv" firstAttribute="leading" secondItem="6jg-tf-s0b" secondAttribute="leading" id="xkf-hy-wp1"/>
                            <constraint firstItem="jim-qG-8NV" firstAttribute="top" secondItem="3j6-e7-ztE" secondAttribute="bottom" priority="750" id="zW5-Vq-dsE"/>
                        </constraints>
@@ -1859,6 +1859,7 @@
                        <outlet property="noVideoLabel" destination="pg3-8C-ucI" id="pWG-m9-pOS"/>
                        <outlet property="playButton" destination="Z3E-1u-wEn" id="kh9-WC-095"/>
                        <outlet property="playTimeLabel" destination="ruu-Hg-3Tx" id="wAa-dH-XNO"/>
                        <outlet property="playViewWHScale" destination="0Wa-du-utY" id="4f8-NA-Y6I"/>
                        <outlet property="playbackList" destination="jim-qG-8NV" id="dpb-Sy-z2g"/>
                        <outlet property="playerToolbox" destination="buq-PS-h5p" id="1ue-bg-0Vs"/>
                        <outlet property="playerToolboxConstraint" destination="tMQ-jL-rdi" id="STA-TC-Nan"/>
EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a
Binary files differ
EZSDK/EZSDK/EZ/UIViewControllers/EZPlaybackViewController.m
@@ -31,6 +31,7 @@
{
    BOOL _isOpenSound;
    BOOL _isPlaying;
    BOOL _landscape;    // 是否旋转
    
    NSTimeInterval _playSeconds; //播放秒数
    NSTimeInterval _duringSeconds; //录像时长
@@ -57,6 +58,7 @@
@property (nonatomic, strong) HIKLoadView *loadingView;
@property (nonatomic) BOOL isSelectedDevice;
@property (nonatomic, weak) IBOutlet UIView *playerView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *playViewWHScale;
@property (nonatomic, weak) IBOutlet UILabel *largeTitleLabel;
@property (nonatomic, weak) IBOutlet UIDatePicker *datePicker;
@property (nonatomic, weak) IBOutlet UITextField *dateTextField;
@@ -115,6 +117,7 @@
    self.isAutorotate = YES;
    self.largeTitleLabel.text = self.deviceInfo.deviceName;
    self.largeTitleLabel.hidden = YES;
    _landscape = NO;
    
    if(!_records)
        _records = [NSMutableArray new];
@@ -227,7 +230,17 @@
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    if (@available(iOS 16.0, *)) {
        if (_landscape) {
            //横屏
            return UIInterfaceOrientationMaskLandscape;
        } else {
            //竖屏
            return UIInterfaceOrientationMaskPortrait;
        }
    } else {
    return UIInterfaceOrientationMaskAllButUpsideDown;
    }
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
@@ -242,6 +255,13 @@
    self.largeButton.hidden = NO;
    self.voiceButton.hidden = NO;
    self.playButton.hidden = NO;
    [self.playerView setTranslatesAutoresizingMaskIntoConstraints:NO];
    [NSLayoutConstraint deactivateConstraints:@[self.playViewWHScale]];
    self.playViewWHScale = [NSLayoutConstraint constraintWithItem:self.playerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeHeight multiplier:16/9. constant:0];
    [NSLayoutConstraint activateConstraints:@[self.playViewWHScale]];
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.playerView layoutIfNeeded];
    });
    if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
       toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
    {
@@ -254,6 +274,18 @@
        self.playbackList.hidden = YES;
        self.largeBackButton.hidden = NO;
        self.navigationController.navigationBarHidden = YES;
        CGFloat tureScreenW = HDLEZ_APP_SCREEN_WIDTH > HDLEZ_APP_SCREEN_HEIGHT ? HDLEZ_APP_SCREEN_HEIGHT : HDLEZ_APP_SCREEN_WIDTH;
        CGFloat tureScreenH = HDLEZ_APP_SCREEN_WIDTH < HDLEZ_APP_SCREEN_HEIGHT ? HDLEZ_APP_SCREEN_HEIGHT : HDLEZ_APP_SCREEN_WIDTH;
        [self.playerView setTranslatesAutoresizingMaskIntoConstraints:NO];
        [NSLayoutConstraint deactivateConstraints:@[self.playViewWHScale]];
        self.playViewWHScale = [NSLayoutConstraint constraintWithItem:self.playerView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.playerView attribute:NSLayoutAttributeHeight multiplier:tureScreenH/(tureScreenW) constant:0];
        [NSLayoutConstraint activateConstraints:@[self.playViewWHScale]];
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.playerView layoutIfNeeded];
        });
    }
}
@@ -757,14 +789,60 @@
- (IBAction)large:(id)sender
{
//    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
//    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
    if (_landscape == YES) {
        [self largeBack:self.largeBackButton];
        return;
    }
    _landscape = YES;
    if (@available(iOS 16.0, *)) {
        if (self.navigationController) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations];
            });
        } else {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self setNeedsUpdateOfSupportedInterfaceOrientations];
            });
        }
        NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
        UIWindowScene *ws = (UIWindowScene *)array.firstObject;
        UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] init];
        geometryPreferences.interfaceOrientations = UIInterfaceOrientationMaskLandscape;
        [ws requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) {
            NSLog(@"iOS 16 Error: %@",error);
        }];
    } else {
    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
    }
}
- (IBAction)largeBack:(id)sender
{
    _landscape = NO;
    if (@available(iOS 16.0, *)) {
        if (self.navigationController) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations];
            });
        } else {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self setNeedsUpdateOfSupportedInterfaceOrientations];
            });
        }
        NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
        UIWindowScene *ws = (UIWindowScene *)array.firstObject;
        UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] init];
        geometryPreferences.interfaceOrientations = UIInterfaceOrientationMaskPortrait;
        [ws requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) {
            NSLog(@"iOS 16 Error: %@",error);
        }];
    } else {
    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
    }
}
- (IBAction)voiceButtonClicked:(id)sender
@@ -1160,4 +1238,8 @@
    }
}
- (BOOL)prefersHomeIndicatorAutoHidden {
    return YES;
}
@end