소스 검색

1.音频播放需求

huangxiaodong 11 달 전
부모
커밋
15ba83ca08
2개의 변경된 파일120개의 추가작업 그리고 1개의 파일을 삭제
  1. 59 1
      创维盒子/双子星云手机/cloudPhone/cloudPhoneViewController.m
  2. 61 0
      创维盒子/双子星云手机/mine/mineViewController.m

+ 59 - 1
创维盒子/双子星云手机/cloudPhone/cloudPhoneViewController.m

@@ -9,6 +9,10 @@
 #import "cloudPhoneSetView.h"
 #import "PlayerViewController.h"
 
+#import "audioPlayingView.h"
+#import "DFPlayer.h"
+#import "audioPlayerViewController.h"
+
 @interface cloudPhoneViewController ()
 @property (nonatomic,strong) cloudPhoneSetView *cloudPhoneSetV;
 @end
@@ -374,7 +378,7 @@
 
 - (void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];
-    
+    [self handelAudioPlayingViewFun];
 }
 
 - (void)viewWillDisappear:(BOOL)animated{
@@ -387,4 +391,58 @@
     [self.navigationController pushViewController:vc animated:animated];
 }
 
+#pragma mark 处理音频播放中的视图状态
+- (void)handelAudioPlayingViewFun
+{
+    audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
+    
+    if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
+       ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying
+       ||[DFPlayer sharedPlayer].state == DFPlayerStatePause){//播放中
+        
+        [self showAudioPlayingViewFun];
+    }
+    else{
+        [self hideAudioPlayingViewFun];
+    }
+    
+    KWeakSelf
+    audioPlayingV.didClickButtonFun = ^(NSInteger tag) {
+        if(tag == 1){
+            [weakSelf hideAudioPlayingViewFun];
+        }
+        else if(tag == 5){
+            [weakSelf AudioPlayingGotoAudioPlayerVCFun];
+        }
+    };
+}
+
+- (void)AudioPlayingGotoAudioPlayerVCFun{
+    audioPlayerViewController *vc = [audioPlayerViewController new];
+    vc.isfirstEnterType = NO;
+    [self.navigationController pushViewController:vc animated:YES];
+}
+    
+#pragma mark 显示音频播放中的视图
+- (void)showAudioPlayingViewFun
+{
+    audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
+    [self.view addSubview:audioPlayingV];
+    
+    [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(49);
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.bottom.mas_equalTo(-TABBARHEIGHT);
+    }];
+    
+
+}
+
+#pragma mark 隐藏音频播放中的视图
+- (void)hideAudioPlayingViewFun
+{
+//    audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
+//    [audioPlayingV removeFromSuperview];
+}
 @end

+ 61 - 0
创维盒子/双子星云手机/mine/mineViewController.m

@@ -16,6 +16,10 @@
 #import "customDownloadCacheManager.h"
 #import "CustomerWebViewController.h"
 
+#import "audioPlayingView.h"
+#import "DFPlayer.h"
+#import "audioPlayerViewController.h"
+
 @interface mineViewController ()
 @property(nonatomic,strong)UIButton *netButton;
 @property(nonatomic,strong)UILabel *snLabel;
@@ -473,6 +477,8 @@
 {
     [super viewWillAppear:animated];
     [self setDataFun];
+    
+    [self handelAudioPlayingViewFun];
 }
 
 - (void)viewWillDisappear:(BOOL)animated{
@@ -485,4 +491,59 @@
     [self.navigationController pushViewController:vc animated:animated];
 }
 
+
+#pragma mark 处理音频播放中的视图状态
+- (void)handelAudioPlayingViewFun
+{
+    audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
+    
+    if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
+       ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying
+       ||[DFPlayer sharedPlayer].state == DFPlayerStatePause){//播放中
+        
+        [self showAudioPlayingViewFun];
+    }
+    else{
+        [self hideAudioPlayingViewFun];
+    }
+    
+    KWeakSelf
+    audioPlayingV.didClickButtonFun = ^(NSInteger tag) {
+        if(tag == 1){
+            [weakSelf hideAudioPlayingViewFun];
+        }
+        else if(tag == 5){
+            [weakSelf AudioPlayingGotoAudioPlayerVCFun];
+        }
+    };
+}
+
+- (void)AudioPlayingGotoAudioPlayerVCFun{
+    audioPlayerViewController *vc = [audioPlayerViewController new];
+    vc.isfirstEnterType = NO;
+    [self.navigationController pushViewController:vc animated:YES];
+}
+    
+#pragma mark 显示音频播放中的视图
+- (void)showAudioPlayingViewFun
+{
+    audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
+    [self.view addSubview:audioPlayingV];
+    
+    [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(49);
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.bottom.mas_equalTo(-TABBARHEIGHT);
+    }];
+    
+
+}
+
+#pragma mark 隐藏音频播放中的视图
+- (void)hideAudioPlayingViewFun
+{
+//    audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
+//    [audioPlayingV removeFromSuperview];
+}
 @end