Skip to content

Commit

Permalink
feat(Apple): add interface for CicadaAudioSessionDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
skufly authored and pingkai committed Apr 30, 2020
1 parent bcbaae7 commit 0d8b537
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion platform/Apple/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ include_directories(
./thumbnail
${TOP_DIR}/mediaPlayer
${TOP_DIR}/framework
${TOP_DIR}/framework/render/video/glRender/platform/ios)
${TOP_DIR}/framework/render/video/glRender/platform/ios
${TOP_DIR}/framework/render/audio/Apple)

link_directories(${SRC_LIBRARIES_DIR})

Expand All @@ -64,6 +65,7 @@ set(SOURCE_LIST
CicadaSource.h
CicadaDelegate.h
CicadaErrorCode.h
${TOP_DIR}/framework/render/audio/Apple/CicadaAudioSessionDelegate.h
thumbnail/CicadaThumbnail.h
thumbnail/CicadaThumbnail.mm
thumbnail/CicadaThumbnailItem.h
Expand Down Expand Up @@ -92,6 +94,7 @@ set(PUBLIC_HEADERS
CicadaPlayerSDK.h
CicadaDelegate.h
CicadaErrorCode.h
${TOP_DIR}/framework/render/audio/Apple/CicadaAudioSessionDelegate.h
)

if (IOS)
Expand Down
11 changes: 11 additions & 0 deletions platform/Apple/source/CicadaPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "CicadaMediaInfo.h"
#import "CicadaConfig.h"
#import "CicadaCacheConfig.h"
#import "CicadaAudioSessionDelegate.h"

OBJC_EXPORT
@interface CicadaPlayer : NSObject
Expand Down Expand Up @@ -503,6 +504,16 @@ OBJC_EXPORT
*/
@property (nonatomic, weak) id<CicadaDelegate> delegate;

/**
@brief 设置AudioSession的Delegate
@param delegate Delegate对象
*/
/****
@brief 设置AudioSession的Delegate
@param delegate Delegate对象
*/
+ (void)setAudioSessionDelegate:(id<CicadaAudioSessionDelegate>)delegate;

/**
@brief 设置日志打印回调block,异步
@param logLevel log输出级别
Expand Down
8 changes: 8 additions & 0 deletions platform/Apple/source/CicadaPlayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "utils/frame_work_log.h"
#import "thumbnail/CicadaThumbnail.h"
#import "CicadaOCHelper.h"
#import "AFAudioSession.h"

using namespace std;
using namespace Cicada;
Expand Down Expand Up @@ -923,4 +924,11 @@ + (void) initPlayerComponent:(NSString *)functionName function:(void*)function
}
}

+ (void)setAudioSessionDelegate:(id<CicadaAudioSessionDelegate>)delegate
{
#if TARGET_OS_IPHONE
[AFAudioSession sharedInstance].delegate = delegate;
#endif
}

@end

0 comments on commit 0d8b537

Please sign in to comment.