浏览代码

1.音频播放时,nas模块播放视频、进入云机、真机播放音频等操作不会中断音乐播放

huangxiaodong 1 年之前
父节点
当前提交
ec851fe896

+ 13 - 1
创维盒子/双子星云手机/Class/Set/previewFile/videoPlayByAVPlayerViewController.m

@@ -24,7 +24,7 @@
 #import "ZFPlayerConst.h"
 #import "ZFUtilities.h"
 #import "lastFileManager.h"
-
+#import "DFPlayer.h"
 
 @interface videoPlayByAVPlayerViewController ()
 @property (nonatomic, strong) ZFPlayerController *player;
@@ -44,6 +44,7 @@
 @property (nonatomic, strong)previewVideoLandscapeTopMoreView *previewVideoLandscapeTopMoreV;
 @property(nonatomic,strong)  editShareView *editShareV;
 @property(nonatomic,assign) BOOL isPortraitType;//竖屏状态
+@property(nonatomic,assign) BOOL isCodeSuspendAudioType;//手动暂停播放音乐
 @end
 
 @implementation videoPlayByAVPlayerViewController
@@ -100,6 +101,12 @@
     
     //数据埋点
     [[netWorkManager shareInstance] DataEmbeddingPointBy:4 withEventValue:@"Video_preview"];
+    
+    if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
+       ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying){
+        _isCodeSuspendAudioType = YES;
+        [[DFPlayer sharedPlayer] df_pause];
+    }
 }
 
 - (void)viewDidAppear:(BOOL)animated
@@ -429,6 +436,11 @@
 - (void)didClickBackBtnFun
 {
     [self.player stop];
+    
+    if(_isCodeSuspendAudioType){
+        [[DFPlayer sharedPlayer] df_play];
+    }
+    
     [self.navigationController popViewControllerAnimated:YES];
 }
 

+ 3 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.h

@@ -33,6 +33,7 @@
 #import "customDownloadManager.h"
 #import "boxDownloadFileManager.h"
 #import "errorAlertTool.h"
+#import "DFPlayer.h"
 
 @protocol PlayerViewControllerDelegate <NSObject>
 
@@ -150,6 +151,8 @@
 //下载nas文件用到
 @property (nonatomic, copy) NSString*nasFullPath;
 
+@property(nonatomic,assign) BOOL isCodeSuspendAudioType;//手动暂停播放音乐
+
 /**
  * @brief 云手机类型  VIP星动云手机  SVIP星曜云手机  STAR 唔即云手机
  */

+ 12 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -217,6 +217,12 @@ UIDocumentPickerDelegate>
     haveBack = NO;
     
     [self   startCheckThridRuiYunTimerFun];
+    
+    if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
+       ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying){
+        _isCodeSuspendAudioType = YES;
+        [[DFPlayer sharedPlayer] df_pause];
+    }
 }
 
 #pragma mark 启动检测瑞云的timer
@@ -1352,6 +1358,12 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
 #pragma mark 退出云机
 - (void)exitCloudPhoneFun
 {
+    self.isNeedRecyclResource = YES;
+    [self setShowImgAndVoiceTypeFun:NO];
+    if(_isCodeSuspendAudioType){
+        [[DFPlayer sharedPlayer] df_play];
+    }
+    
     [self.navigationController popViewControllerAnimated:YES];
 }