Bläddra i källkod

1.音乐悬浮窗位置调整到【nas
2.音乐悬浮窗去掉【播放列表】新增【关闭按钮】,关闭后悬浮窗不再展示。关闭悬浮窗歌曲也对应关闭

huangxiaodong 11 månader sedan
förälder
incheckning
cc650aa40f
18 ändrade filer med 458 tillägg och 11 borttagningar
  1. 12 0
      创维盒子/双子星云手机.xcodeproj/project.pbxproj
  2. 22 0
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_del_icon.imageset/Contents.json
  3. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_del_icon.imageset/nas_audio_playing_del_icon@2x.png
  4. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_del_icon.imageset/nas_audio_playing_del_icon@3x.png
  5. 22 0
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_img.imageset/Contents.json
  6. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_img.imageset/nas_audio_playing_img@2x.png
  7. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_img.imageset/nas_audio_playing_img@3x.png
  8. 22 0
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_pause_icon.imageset/Contents.json
  9. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_pause_icon.imageset/nas_audio_playing_pause_icon@2x.png
  10. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_pause_icon.imageset/nas_audio_playing_pause_icon@3x.png
  11. 22 0
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_play_icon.imageset/Contents.json
  12. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_play_icon.imageset/nas_audio_playing_play_icon@2x.png
  13. BIN
      创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_play_icon.imageset/nas_audio_playing_play_icon@3x.png
  14. 18 10
      创维盒子/双子星云手机/Class/Set/previewFile/audioPlayerViewController.m
  15. 76 1
      创维盒子/双子星云手机/NAS/NASViewController.m
  16. 23 0
      创维盒子/双子星云手机/NAS/view/audioPlayingView.h
  17. 234 0
      创维盒子/双子星云手机/NAS/view/audioPlayingView.m
  18. 7 0
      创维盒子/双子星云手机/Vendor/DFPlayer/DFPlayer.m

+ 12 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -182,6 +182,10 @@
 		6B07E0B32C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0B02C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h */; };
 		6B07E0B42C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0B02C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h */; };
 		6B07E0B52C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07E0B12C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m */; };
+		6B0A75DF2C4CA3D300DCB32D /* audioPlayingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0A75DE2C4CA3D300DCB32D /* audioPlayingView.m */; };
+		6B0A75E02C4CA3D300DCB32D /* audioPlayingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0A75DD2C4CA3D300DCB32D /* audioPlayingView.h */; };
+		6B0A75E12C4CA3D300DCB32D /* audioPlayingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0A75DE2C4CA3D300DCB32D /* audioPlayingView.m */; };
+		6B0A75E22C4CA3D300DCB32D /* audioPlayingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0A75DD2C4CA3D300DCB32D /* audioPlayingView.h */; };
 		6B0D004B2BFE104B00F02719 /* queryOneShareModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */; };
 		6B0D004C2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
 		6B0D004D2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
@@ -1538,6 +1542,8 @@
 		6B07E0AB2C3D1ED5004A3238 /* nasLastFileViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = nasLastFileViewController.m; sourceTree = "<group>"; };
 		6B07E0B02C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ComontAlretDeleteTypeViewController.h; sourceTree = "<group>"; };
 		6B07E0B12C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ComontAlretDeleteTypeViewController.m; sourceTree = "<group>"; };
+		6B0A75DD2C4CA3D300DCB32D /* audioPlayingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = audioPlayingView.h; sourceTree = "<group>"; };
+		6B0A75DE2C4CA3D300DCB32D /* audioPlayingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = audioPlayingView.m; sourceTree = "<group>"; };
 		6B0D00492BFE104B00F02719 /* queryOneShareModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = queryOneShareModel.h; sourceTree = "<group>"; };
 		6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = queryOneShareModel.m; sourceTree = "<group>"; };
 		6B1CC2C42B677F3D00AD4217 /* extraMediaEventModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = extraMediaEventModel.h; sourceTree = "<group>"; };
@@ -3064,6 +3070,8 @@
 				6B9283652C4B62A30098CC75 /* newerGuideView.m */,
 				6B92836A2C4B94310098CC75 /* errorAlertTool.h */,
 				6B92836B2C4B94310098CC75 /* errorAlertTool.m */,
+				6B0A75DD2C4CA3D300DCB32D /* audioPlayingView.h */,
+				6B0A75DE2C4CA3D300DCB32D /* audioPlayingView.m */,
 			);
 			path = view;
 			sourceTree = "<group>";
@@ -3746,6 +3754,7 @@
 				6B2C1E7C2C070ADE00FDCF82 /* ZFOrientationObserver.h in Headers */,
 				6B2C1E842C070ADE00FDCF82 /* ZFPlayer.h in Headers */,
 				6B2C1E3E2C070ADE00FDCF82 /* ZFPortraitControlView.h in Headers */,
+				6B0A75E02C4CA3D300DCB32D /* audioPlayingView.h in Headers */,
 				6B3F963A2AD2AD0B008E349E /* newWorkInterface.h in Headers */,
 				6B0581B22AFE02B100D37290 /* uploadFileBottomView.h in Headers */,
 				18F9CAFC2ABD35C4003FF71A /* ModifyPWDFirstViewController.h in Headers */,
@@ -4008,6 +4017,7 @@
 				6B2C1E7D2C070ADE00FDCF82 /* ZFOrientationObserver.h in Headers */,
 				6B2C1E852C070ADE00FDCF82 /* ZFPlayer.h in Headers */,
 				6B2C1E3F2C070ADE00FDCF82 /* ZFPortraitControlView.h in Headers */,
+				6B0A75E22C4CA3D300DCB32D /* audioPlayingView.h in Headers */,
 				6BD506B02B9576A4006E7CB0 /* newWorkInterface.h in Headers */,
 				6BD506B12B9576A4006E7CB0 /* uploadFileBottomView.h in Headers */,
 				6BD506B22B9576A4006E7CB0 /* ModifyPWDFirstViewController.h in Headers */,
@@ -4667,6 +4677,7 @@
 				6BD507332B9576A4006E7CB0 /* Calculator.m in Sources */,
 				6B93549D2BF369D000AA8D31 /* previewToUploadFileView.m in Sources */,
 				6BD507342B9576A4006E7CB0 /* HWWebViewController.m in Sources */,
+				6B0A75E12C4CA3D300DCB32D /* audioPlayingView.m in Sources */,
 				6B8661DF2BBA578600B19846 /* HaveNoticeView.m in Sources */,
 				6BD507352B9576A4006E7CB0 /* HWBookmarkListCell.m in Sources */,
 				6BD507362B9576A4006E7CB0 /* downLoadPreViewCell.m in Sources */,
@@ -5011,6 +5022,7 @@
 				18E557212A3C5D75005CC84B /* Calculator.m in Sources */,
 				6B93549A2BF369D000AA8D31 /* previewToUploadFileView.m in Sources */,
 				A003F6ED27D84D9C00715CBF /* HWWebViewController.m in Sources */,
+				6B0A75DF2C4CA3D300DCB32D /* audioPlayingView.m in Sources */,
 				6B8661DC2BBA578600B19846 /* HaveNoticeView.m in Sources */,
 				A031DD6D27EC1FCD00909527 /* HWBookmarkListCell.m in Sources */,
 				6B5D40302B4BCBC1000965CF /* downLoadPreViewCell.m in Sources */,

+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_del_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "nas_audio_playing_del_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "nas_audio_playing_del_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_del_icon.imageset/nas_audio_playing_del_icon@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_del_icon.imageset/nas_audio_playing_del_icon@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_img.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "nas_audio_playing_img@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "nas_audio_playing_img@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_img.imageset/nas_audio_playing_img@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_img.imageset/nas_audio_playing_img@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_pause_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "nas_audio_playing_pause_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "nas_audio_playing_pause_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_pause_icon.imageset/nas_audio_playing_pause_icon@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_pause_icon.imageset/nas_audio_playing_pause_icon@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_play_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "nas_audio_playing_play_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "nas_audio_playing_play_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_play_icon.imageset/nas_audio_playing_play_icon@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/NAS/nas_audio_playing_play_icon.imageset/nas_audio_playing_play_icon@3x.png


+ 18 - 10
创维盒子/双子星云手机/Class/Set/previewFile/audioPlayerViewController.m

@@ -777,17 +777,25 @@
 {
     [super viewDidAppear:animated];
     
-    [self setTitleFunByIndex];
-    [[DFPlayer sharedPlayer] df_reloadData];//需在传入数据源后调用
-    
-    if(_isfirstEnterType){
-        KWeakSelf
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [weakSelf playAudioFun];
-            self->_isfirstEnterType = NO;
-        });
+    if(_outSideDataModel){
+        [self setTitleFunByIndex];
+        [[DFPlayer sharedPlayer] df_reloadData];//需在传入数据源后调用
+        
+        if(_isfirstEnterType){
+            KWeakSelf
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                [weakSelf playAudioFun];
+                self->_isfirstEnterType = NO;
+            });
+        }
+    }
+    else{//点击playingview 进来的
+        
+        _allAudioDataArray = [audioPlayListManager shareManager].audioPlayListArr;
+        _lastAudioIndex = -1;
+        _index = [DFPlayer sharedPlayer].currentAudioModel.audioId;
+        [self setTitleFunByIndex];
     }
-    
 }
 
 - (void)viewDidDisappear:(BOOL)animated

+ 76 - 1
创维盒子/双子星云手机/NAS/NASViewController.m

@@ -34,16 +34,20 @@
 #import "CustomerWebViewController.h"
 #import "noticeModel.h"
 #import "HaveNoticeView.h"
+#import "audioPlayingView.h"
+#import "DFPlayer.h"
 
 @interface NASViewController ()<UITableViewDelegate,UITableViewDataSource>
 {
     BOOL canShareType;
     
+    UIImageView *welcomeImageV;
     UIView* rightRedView;//
     BOOL hadUploadTaskType;
     BOOL hadDownloadTaskType;
     
     BOOL didGetSysInfoType;//是否收到过系统信息用在---用来判断是否要走弹框流程
+    
 }
 @property (nonatomic,strong)UITableView*tableView;
 
@@ -109,7 +113,7 @@
     }
     
     CGFloat imageTopY =  54.0;
-    UIImageView *welcomeImageV = [UIImageView new];
+    welcomeImageV = [UIImageView new];
     welcomeImageV.image = [UIImage imageNamed:welcomeImageStr];
     [self.view addSubview:welcomeImageV];
     
@@ -594,6 +598,8 @@
     });
     
     [self beginShowAlertFun];
+    
+    [self handelAudioPlayingViewFun];
 }
 
 - (void)viewWillDisappear:(BOOL)animated{
@@ -1016,4 +1022,73 @@
     }];
     
 }
+
+
+#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);
+    }];
+    
+    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
+        make.bottom.mas_equalTo(-TABBARHEIGHT -49);
+    }];
+    
+}
+
+#pragma mark 隐藏音频播放中的视图
+- (void)hideAudioPlayingViewFun
+{
+//    audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
+//    [audioPlayingV removeFromSuperview];
+    
+    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
+        make.bottom.mas_equalTo(-TABBARHEIGHT);
+    }];
+}
 @end

+ 23 - 0
创维盒子/双子星云手机/NAS/view/audioPlayingView.h

@@ -0,0 +1,23 @@
+//
+//  audioPlayingView.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/21.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface audioPlayingView : UIView
+@property (nonatomic,copy) void (^didClickButtonFun)(NSInteger tag);
+
++ (instancetype)sharedInstance; 
+
+- (void)startRotatingImage;
+- (void)stopRotatingImage;
+- (void)setAudioTitleFunBy:(NSInteger)AudioID;
+- (void)setAudioPlayingStateFunBy:(BOOL)isPlaying;
+@end
+
+NS_ASSUME_NONNULL_END

+ 234 - 0
创维盒子/双子星云手机/NAS/view/audioPlayingView.m

@@ -0,0 +1,234 @@
+//
+//  audioPlayingView.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/21.
+//
+
+#import "audioPlayingView.h"
+#import "DFPlayer.h"
+#import "audioPlayListManager.h"
+
+@interface audioPlayingView ()
+@property(nonatomic,strong)UIImageView*bgImageView;
+@property (nonatomic, strong) CABasicAnimation *rotationAnimation;
+@property (nonatomic, strong)UIButton *playOrPausebut;
+@property (nonatomic, strong)UILabel *audioTitleLabel;
+@end
+
+@implementation audioPlayingView
+
+// 静态变量,用于存储单例实例
+static audioPlayingView *sharedInstance = nil;
+  
++ (instancetype)sharedInstance {
+    // 使用dispatch_once保证线程安全
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        sharedInstance = [[self alloc] init];
+    });
+    return sharedInstance;
+}
+
+- (id)initWithFrame:(CGRect)frame{
+    self = [super initWithFrame:frame];
+    
+    self.backgroundColor = [UIColor whiteColor];
+    [self drawAnyView];
+    
+    return self;
+}
+
+-(void)drawAnyView
+{
+    //上 线
+    UIView *toplineView = [[UIView alloc] init];
+    toplineView.backgroundColor = [UIColor hwColor:@"#E9E9E9"];
+    [self addSubview:toplineView];
+    [toplineView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.height.mas_equalTo(1);
+        make.top.mas_equalTo(0);
+    }];
+    
+    //下 线
+    UIView *bottomlineView = [[UIView alloc] init];
+    bottomlineView.backgroundColor = [UIColor hwColor:@"#E9E9E9"];
+    [self addSubview:bottomlineView];
+    [bottomlineView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.height.mas_equalTo(1);
+        make.bottom.mas_equalTo(-1);
+    }];
+    
+    //旋转图片
+    _bgImageView = [UIImageView new];
+    _bgImageView.image = [UIImage imageNamed:@"nas_audio_playing_img"];
+    [self addSubview:_bgImageView];
+    
+    [_bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.mas_equalTo(0);
+        make.width.mas_equalTo(40);
+        make.height.mas_equalTo(40);
+        make.left.mas_equalTo(16);
+    }];
+    
+    //删除按钮
+    UIButton *deletebut = [[UIButton alloc] init];
+    deletebut.tag = 1;
+    [deletebut addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
+    [deletebut setImage:[UIImage imageNamed:@"nas_audio_playing_del_icon"] forState:UIControlStateNormal];
+    [self addSubview:deletebut];
+
+    [deletebut mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-10);
+        make.width.mas_equalTo(30);
+        make.height.mas_equalTo(40);
+        make.centerY.mas_equalTo(0);
+    }];
+
+    //播放或者状态按钮
+    _playOrPausebut = [[UIButton alloc] init];
+    _playOrPausebut.tag = 2;
+    [_playOrPausebut addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
+    [_playOrPausebut setImage:[UIImage imageNamed:@"nas_audio_playing_play_icon"] forState:UIControlStateSelected];
+    [_playOrPausebut setImage:[UIImage imageNamed:@"nas_audio_playing_pause_icon"] forState:UIControlStateNormal];
+    [self addSubview:_playOrPausebut];
+
+    [_playOrPausebut mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.equalTo(deletebut.mas_left).offset(-10);
+        make.width.mas_equalTo(30);
+        make.height.mas_equalTo(40);
+        make.centerY.mas_equalTo(0);
+    }];
+
+    
+    //音频标题
+    _audioTitleLabel = [[UILabel alloc] init];
+    _audioTitleLabel.font = [UIFont systemFontOfSize:12.0];
+    _audioTitleLabel.textColor = [UIColor hwColor:@"#666666"];
+    //_audioTitleLabel.text = @"";
+    [self addSubview:_audioTitleLabel];
+    
+    [_audioTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(20);
+        make.left.equalTo(_bgImageView.mas_right).offset(8);
+        make.right.equalTo(_playOrPausebut.mas_left).offset(-10);
+        make.centerY.mas_equalTo(0);
+    }];
+
+    //点击标题按钮
+    UIButton *titlebut = [[UIButton alloc] init];
+    titlebut.tag = 5;
+    [titlebut addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
+    [self addSubview:titlebut];
+
+    [titlebut mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.equalTo(_audioTitleLabel.mas_left).offset(0);
+        make.right.equalTo(_audioTitleLabel.mas_right).offset(0);
+        make.height.mas_equalTo(40);
+        make.centerY.mas_equalTo(0);
+    }];
+
+}
+
+
+#pragma mark 图片旋转相关
+- (void)startRotatingImage {
+    // 停止当前动画(如果有的话)
+    [self stopRotatingImage];
+    
+    // 创建一个CABasicAnimation实例
+    self.rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
+    
+    // 设置动画的起始值(从0度开始)
+    self.rotationAnimation.fromValue = [NSNumber numberWithFloat:0];
+    
+    // 设置动画的结束值(旋转360度,注意这里是弧度制)
+    self.rotationAnimation.toValue = [NSNumber numberWithFloat:M_PI * 2];
+    
+    // 设置动画的持续时间
+    self.rotationAnimation.duration = 5.0; // 可以根据需要调整旋转速度
+    
+    // 设置动画的重复次数,这里设置为HUGE_VALF表示无限次
+    self.rotationAnimation.repeatCount = HUGE_VALF;
+    
+    // 将动画添加到imageView的layer上
+    [self.bgImageView.layer addAnimation:self.rotationAnimation forKey:@"rotateAnimation"];
+}
+
+- (void)stopRotatingImage {
+    // 移除imageView上的动画
+    [self.bgImageView.layer removeAnimationForKey:@"rotateAnimation"];
+    
+    
+    [UIView animateWithDuration:5 animations:^{
+        self.bgImageView.layer.transform = CATransform3DIdentity;
+    }];
+
+}
+
+- (void)restartRotatingImage {
+    // 直接调用startRotatingImage来重新启动动画
+    [self startRotatingImage];
+}
+
+
+#pragma mark 按钮事件
+- (void)didClickButtonFun:(UIButton*)but
+{
+    NSInteger tag = but.tag;
+    HLog(@"%ld",tag);
+    
+    if(tag == 1){
+        [[DFPlayer sharedPlayer] df_deallocPlayer];
+        [self removeFromSuperview];
+    }
+    
+    if(tag == 2){
+        if(but.selected){//
+            [[DFPlayer sharedPlayer] df_play];
+            [self startRotatingImage];
+        }
+        else{
+            [[DFPlayer sharedPlayer] df_pause];
+            [self stopRotatingImage];
+        }
+        
+        but.selected = !but.selected;
+    }
+    
+    if(_didClickButtonFun){
+        _didClickButtonFun(tag);
+    }
+}
+
+- (void)setAudioTitleFunBy:(NSInteger)AudioID
+{
+    NSMutableArray*allDataArr = [audioPlayListManager shareManager].audioPlayListArr;
+    
+    if(allDataArr && allDataArr.count > AudioID){
+        lastFileModel *model = allDataArr[AudioID];
+        mainBlock(^{
+            self->_audioTitleLabel.text = model.name;
+        });
+    }
+}
+
+- (void)setAudioPlayingStateFunBy:(BOOL)isPlaying
+{
+    mainBlock(^{
+        if(isPlaying){
+            self->_playOrPausebut.selected = NO;
+            [self startRotatingImage];
+        }
+        else{
+            self->_playOrPausebut.selected = YES;
+            [self stopRotatingImage];
+        }
+    });
+    
+}
+@end

+ 7 - 0
创维盒子/双子星云手机/Vendor/DFPlayer/DFPlayer.m

@@ -14,6 +14,7 @@
 
 //hxd add 20240716
 #import "audioPlayListManager.h"
+#import "audioPlayingView.h"
 
 /**Asset KEY*/
 NSString * const DFPlayableKey                  = @"playable";
@@ -336,6 +337,9 @@ NSString * const DFPlaybackLikelyToKeepUpKey    = @"playbackLikelyToKeepUp";
         }
     }
     
+    [[audioPlayingView sharedInstance] setAudioTitleFunBy:self.currentAudioModel.audioId];
+    [[audioPlayingView sharedInstance] setAudioPlayingStateFunBy:YES];
+    
     if ([DFPlayerTool isLocalAudio:self.currentAudioModel.audioUrl]) {
 //        NSLog(@"-- DFPlayer:本地音频,Id:%ld",(unsigned long)self.currentAudioModel.audioId);
         _isCached = YES;
@@ -707,6 +711,9 @@ NSString * const DFPlaybackLikelyToKeepUpKey    = @"playbackLikelyToKeepUp";
 -(void)df_pause{
     self.state = DFPlayerStatePause;
     [self.player pause];
+    
+    //hxd add 20240721
+    [[audioPlayingView sharedInstance] setAudioPlayingStateFunBy:NO];
 }
 
 /**下一首*/