@@ -523,6 +523,42 @@ - (void)seekDesignatedPointWithCurrentTime:(NSString *)currentTime selectedTimeM
523523 });
524524}
525525
526+ // / MARK: 发送暂停或继续播放信令
527+ - (void )sendPauseOrResumeSignallingWithSwitch : (BOOL )isPause {
528+ NSString *channel = @" 0" ;
529+ if (self.isNVR == YES ) {
530+ channel = self.deviceModel .Channel ?:@" " ;
531+ }else {
532+ channel = @" 0" ;
533+ }
534+
535+ dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(1 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
536+ NSString *actionString = [NSString stringWithFormat: @" action=inner_define&channel=%@ &cmd=playback_pause" ,channel];
537+ if (isPause == NO ) {
538+ actionString = [NSString stringWithFormat: @" action=inner_define&channel=%@ &cmd=playback_resume" ,channel];
539+ }
540+
541+ [[TIoTCoreXP2PBridge sharedInstance ] getCommandRequestWithAsync: self .deviceName?:@" " cmd: actionString timeout: 2 *1000 *1000 completion: ^(NSString * _Nonnull jsonList) {
542+
543+ TIoTDemoDeviceStatusModel *responseModel = [TIoTDemoDeviceStatusModel yy_modelWithJSON: jsonList];
544+ if ([responseModel.status isEqualToString: @" 0" ]) {
545+
546+ if (isPause == YES ) {
547+ // 暂停
548+ [self pauseVideo ];
549+ }else {
550+ // 继续播放
551+ [self resumeVideo ];
552+ }
553+
554+ }else {
555+ // 设备状态异常提示
556+ [TIoTCoreUtil showDeviceStatusError: responseModel commandInfo: [NSString stringWithFormat: @" 发送信令: %@ \n\n 接收: %@ " ,actionString,jsonList]];
557+ }
558+ }];
559+ });
560+ }
561+
526562// / MARK:开启设备
527563- (void )setVieoPlayerStartPlay {
528564
@@ -725,17 +761,20 @@ - (void)tapVideoView:(UIButton *)button {
725761 if (self.customControlVidwoView .hidden == YES ) {
726762
727763 if (!button.selected ) {
728- [self pauseVideo ];
764+ // [self pauseVideo];
765+ [self sendPauseOrResumeSignallingWithSwitch: YES ];
729766 }
730767 button.selected = !button.selected ;
731768
732769 }else if (self.customControlVidwoView .hidden == NO ) {
733770
734771 if (!button.selected ) {
735- [self pauseVideo ];
772+ // [self pauseVideo];
773+ [self sendPauseOrResumeSignallingWithSwitch: YES ];
736774 }else {
737775
738- [self resumeVideo ];
776+ // [self resumeVideo];
777+ [self sendPauseOrResumeSignallingWithSwitch: NO ];
739778 }
740779
741780 button.selected = !button.selected ;
@@ -954,7 +993,7 @@ - (void)sliderValueChanged:(id)sender {
954993 }
955994 self.isPause = NO ;
956995 self.player .currentPlaybackTime = self.currentTime ;
957- [self startPlayVideoWithStartTime: self .videoTimeModel.StartTime.integerValue endTime: self .videoTimeModel.EndTime.integerValue sliderValue: self .player.currentPlaybackTime ];
996+ [self startPlayVideoWithStartTime: self .videoTimeModel.StartTime.integerValue endTime: self .videoTimeModel.EndTime.integerValue sliderValue: currentTimeModel.StartTime.integerValue ];
958997
959998// [self getFullVideoURLWithPartURL:self.listModel.VideoURL withTime:currentTimeModel isChangeModel:NO];
960999 [self seekDesignatedPointWithCurrentTime: currentTimeModel.StartTime selectedTimeMoel: currentTimeModel isChangeModel: NO ];
0 commit comments