瀏覽代碼

播放器监听优化

Steven 1 年之前
父節點
當前提交
7f9eb0835d

+ 0 - 6
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj

@@ -392,7 +392,6 @@
 		27F9CB0027EC3D42003E0FE4 /* GroupListViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F9CAFE27EC3D41003E0FE4 /* GroupListViewCell.m */; };
 		27F9CB0127EC3D42003E0FE4 /* GroupListViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 27F9CAFF27EC3D42003E0FE4 /* GroupListViewCell.xib */; };
 		27F9CB0427EC5446003E0FE4 /* GroupSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F9CB0327EC5446003E0FE4 /* GroupSettingViewController.m */; };
-		27F9CB0B27EC5C06003E0FE4 /* KSSelectConversationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F9CB0A27EC5C06003E0FE4 /* KSSelectConversationViewController.m */; };
 		27F9CB0E27EC5DF5003E0FE4 /* KSRCloudMediaManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F9CB0C27EC5DF3003E0FE4 /* KSRCloudMediaManager.m */; };
 		27F9CB1127EC60D0003E0FE4 /* GroupListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F9CB0F27EC60CE003E0FE4 /* GroupListModel.m */; };
 		27FC2F5F27F1930400FCC239 /* KSStarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27FC2F5E27F1930400FCC239 /* KSStarView.m */; };
@@ -1997,8 +1996,6 @@
 		27F9CAFF27EC3D42003E0FE4 /* GroupListViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GroupListViewCell.xib; sourceTree = "<group>"; };
 		27F9CB0227EC5446003E0FE4 /* GroupSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GroupSettingViewController.h; sourceTree = "<group>"; };
 		27F9CB0327EC5446003E0FE4 /* GroupSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GroupSettingViewController.m; sourceTree = "<group>"; };
-		27F9CB0927EC5C05003E0FE4 /* KSSelectConversationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSSelectConversationViewController.h; sourceTree = "<group>"; };
-		27F9CB0A27EC5C06003E0FE4 /* KSSelectConversationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSSelectConversationViewController.m; sourceTree = "<group>"; };
 		27F9CB0C27EC5DF3003E0FE4 /* KSRCloudMediaManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSRCloudMediaManager.m; sourceTree = "<group>"; };
 		27F9CB0D27EC5DF4003E0FE4 /* KSRCloudMediaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSRCloudMediaManager.h; sourceTree = "<group>"; };
 		27F9CB0F27EC60CE003E0FE4 /* GroupListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupListModel.m; sourceTree = "<group>"; };
@@ -5199,8 +5196,6 @@
 		27F9CB0627EC5479003E0FE4 /* Controller */ = {
 			isa = PBXGroup;
 			children = (
-				27F9CB0927EC5C05003E0FE4 /* KSSelectConversationViewController.h */,
-				27F9CB0A27EC5C06003E0FE4 /* KSSelectConversationViewController.m */,
 				27F9CB0227EC5446003E0FE4 /* GroupSettingViewController.h */,
 				27F9CB0327EC5446003E0FE4 /* GroupSettingViewController.m */,
 				2755C07527EC945D007D9070 /* GroupMemberViewController.h */,
@@ -9062,7 +9057,6 @@
 				BC71DF012A89F470003F165E /* TXMainEmtpyView.m in Sources */,
 				BC31BF892B219C5700F7D538 /* KSGaugeView.m in Sources */,
 				27F9030027E864AE00C08A19 /* NetworkBodyView.m in Sources */,
-				27F9CB0B27EC5C06003E0FE4 /* KSSelectConversationViewController.m in Sources */,
 				BC8B6DBF28532DB800866917 /* MusicSheetVoList.m in Sources */,
 				2755C08D27ED5DB2007D9070 /* GroupApplyChooseCell.m in Sources */,
 				BC02BCF128B32771005CB483 /* KSDownSeatAllMessage.m in Sources */,

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSAccompanyWebViewController.m

@@ -1723,6 +1723,8 @@
 }
 
 - (void)playerDidError:(kSNewPlayer *)player {
+    [self stopRecordService];
+    [self stopMp3Player]; // 停止播放
     // 播放出现问题
     NSDictionary *postParm = @{@"api" : @"cancelEvaluating",
                                @"content" : @{@"reson":@"播放已停止"}

+ 7 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/MediaMerge/MusicPlayer/kSNewPlayer.m

@@ -388,6 +388,13 @@
 -(void)playerError:(NSNotification *)notice {
     //移除所有监听
     dispatch_main_sync_safe(^{
+        if ([notice.name isEqualToString:AVAudioSessionRouteChangeNotification]) {
+            NSDictionary *info = notice.userInfo;
+            AVAudioSessionRouteChangeReason routeChangeReason = [[info valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue];
+            if (routeChangeReason == AVAudioSessionRouteChangeReasonCategoryChange) {
+                return;
+            }
+        }
         if ([self.delegate respondsToSelector:@selector(playerDidError:)]) {
             [self.delegate playerDidError:self];
         }

+ 0 - 23
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Group/Controller/KSSelectConversationViewController.h

@@ -1,23 +0,0 @@
-//
-//  KSSelectConversationViewController.h
-//  StudentDaya
-//
-//  Created by Kyle on 2021/8/5.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import <RongIMLib/RongIMLib.h>
-#import <RongIMKit/RCBaseViewController.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface KSSelectConversationViewController : RCBaseViewController
-
-- (instancetype)initSelectConversationViewControllerCompleted:
-    (void (^)(NSArray<RCConversation *> *conversationList))completedBlock;
-
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 186
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Group/Controller/KSSelectConversationViewController.m

@@ -1,186 +0,0 @@
-//
-//  KSSelectConversationViewController.m
-//  StudentDaya
-//
-//  Created by Kyle on 2021/8/5.
-//  Copyright © 2021 DayaMusic. All rights reserved.
-//
-
-#import "KSSelectConversationViewController.h"
-#import <RongIMKit/RCKitUtility.h>
-#import <RongIMKit/RCKitCommonDefine.h>
-#import <RongIMKit/RCKitConfig.h>
-#import <RongIMKit/RCIM.h>
-
-@interface RCSelectConversationCell : UITableViewCell
-
-- (void)setConversation:(RCConversation *)conversation ifSelected:(BOOL)ifSelected;
-
-@end
-
-typedef void (^CompleteBlock)(NSArray *conversationList);
-
-@interface KSSelectConversationViewController ()<UITableViewDataSource, UITableViewDelegate>
-
-@property (nonatomic, strong) NSMutableArray *selectedConversationArray;
-
-@property (nonatomic, strong) UITableView *conversationTableView;
-
-@property (nonatomic, strong) UIBarButtonItem *rightBarButtonItem;
-
-@property (nonatomic, strong) NSArray *listingConversationArray;
-
-@property (nonatomic, strong) CompleteBlock completeBlock;
-
-@end
-
-@implementation KSSelectConversationViewController
-
-- (instancetype)initSelectConversationViewControllerCompleted:
-    (void (^)(NSArray<RCConversation *> *conversationList))completedBlock {
-    if (self = [super init]) {
-        self.completeBlock = completedBlock;
-    }
-    return self;
-}
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    [self setupNavi];
-    self.view.backgroundColor = RCDYCOLOR(0xf0f0f6, 0x000000);
-    [self.view addSubview:self.conversationTableView];
-    self.selectedConversationArray = [[NSMutableArray alloc] init];
-    NSMutableArray *listArray = [NSMutableArray array];
-    NSArray *conversationArray = [[RCIMClient sharedRCIMClient] getConversationList:@[@(ConversationType_PRIVATE), @(ConversationType_GROUP)]];
-    
-    for (RCConversation *conversation in conversationArray) {
-        if (conversation.conversationType == ConversationType_GROUP && ![conversation.targetId containsString:@"FAN"] && ![conversation.targetId containsString:@"COURSE"]) { // 视频聊天群不添加
-            
-        }
-        else {
-            [listArray addObject:conversation];
-        }
-    }
-    self.listingConversationArray = [NSArray arrayWithArray:listArray];
-}
-
-#pragma mark - UITableViewDataSource
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    if (!self.listingConversationArray) {
-        return 0;
-    } else {
-        return self.listingConversationArray.count;
-    }
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (self.listingConversationArray.count <= indexPath.row) {
-        return nil;
-    }
-
-    static NSString *reusableID = @"RCSelectConversationCell";
-    RCSelectConversationCell *cell = [tableView dequeueReusableCellWithIdentifier:reusableID];
-    if (!cell) {
-        cell = [[RCSelectConversationCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reusableID];
-    }
-
-    RCConversation *conversation = self.listingConversationArray[indexPath.row];
-    BOOL ifSelected = [self.selectedConversationArray containsObject:conversation];
-    [cell setConversation:conversation ifSelected:ifSelected];
-
-    return cell;
-}
-
-- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-    return 70;
-}
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (indexPath.row >= self.listingConversationArray.count) {
-        return;
-    }
-    NSString *userId = self.listingConversationArray[indexPath.row];
-    if ([self.selectedConversationArray containsObject:userId]) {
-        [self.selectedConversationArray removeObject:userId];
-    } else if (userId) {
-        [self.selectedConversationArray addObject:userId];
-    }
-    [self updateRightButton];
-    [UIView performWithoutAnimation:^{
-        [self.conversationTableView reloadRowsAtIndexPaths:@[ indexPath ] withRowAnimation:UITableViewRowAnimationNone];
-    }];
-}
-
-
-#pragma mark - Target Action
-
-- (void)onLeftButtonClick:(id)sender {
-    [self.navigationController popViewControllerAnimated:NO];
-}
-
-- (void)onRightButtonClick:(id)sender {
-    if (!self.selectedConversationArray) {
-        return;
-    }
-    if (self.completeBlock) {
-        self.completeBlock(self.selectedConversationArray);
-    }
-    [self.navigationController popViewControllerAnimated:NO];
-}
-
-#pragma mark - Private Methods
-- (void)setupNavi {
-    self.title = RCLocalizedString(@"SelectContact");
-    UIBarButtonItem *leftBarItem =
-        [[UIBarButtonItem alloc] initWithTitle:RCLocalizedString(@"Cancel")
-                                         style:UIBarButtonItemStylePlain
-                                        target:self
-                                        action:@selector(onLeftButtonClick:)];
-    leftBarItem.tintColor = RCKitConfigCenter.ui.globalNavigationBarTintColor;
-    self.navigationItem.leftBarButtonItem = leftBarItem;
-
-    self.rightBarButtonItem =
-        [[UIBarButtonItem alloc] initWithTitle:RCLocalizedString(@"OK")
-                                         style:UIBarButtonItemStylePlain
-                                        target:self
-                                        action:@selector(onRightButtonClick:)];
-    self.rightBarButtonItem.tintColor = RCKitConfigCenter.ui.globalNavigationBarTintColor;
-    self.navigationItem.rightBarButtonItem = self.rightBarButtonItem;
-
-    [self updateRightButton];
-}
-
-- (void)updateRightButton {
-    [self.rightBarButtonItem setEnabled:self.selectedConversationArray.count > 0];
-}
-
-#pragma mark - Getters and Setters
-
-- (UITableView *)conversationTableView {
-    if (!_conversationTableView) {
-        _conversationTableView = [[UITableView alloc] init];
-        CGFloat navBarHeight = 64;
-        CGFloat homeBarHeight = [RCKitUtility getWindowSafeAreaInsets].bottom;
-        if (homeBarHeight > 0) {
-            navBarHeight = 88;
-        }
-        _conversationTableView.frame =
-            CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - navBarHeight - homeBarHeight);
-        _conversationTableView.dataSource = self;
-        _conversationTableView.delegate = self;
-        _conversationTableView.backgroundColor = [UIColor clearColor];
-        _conversationTableView.tableFooterView = [[UIView alloc] init];
-    }
-    return _conversationTableView;
-}
-
-/*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
-}
-*/
-
-@end