TencentNavKit
TNKAudioPlayerProtocol.h
Go to the documentation of this file.
1//
2// TNKAudioPlayerProtocol.h
3// TencentNavKit
4//
5// Created by mol on 2022/11/18.
6// Copyright © 2022 Tencent. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
10#import <TencentNavKit/TNKNavTTS.h>
11
12NS_ASSUME_NONNULL_BEGIN
13
14typedef NS_ENUM(NSUInteger, TNKAudioPlayRateType) {
15 TNKAudioPlayRateNormal,
16 TNKAudioPlayRateFast,
17 TNKAudioPlayRateSlow
18};
19
20@class TNKAudioParam;
22
26@protocol TNKAudioPlayerDelegate <NSObject>
27
32- (void)invokeAudioPlayerWillStartPlaying:(id<TNKAudioPlayerProtocol>)player;
33
38- (void)audioPlayerDidFinishPlaying:(id<TNKAudioPlayerProtocol>)player;
39
46- (void)audioPlayerDidFinishPlaying:(id<TNKAudioPlayerProtocol>)player text:(NSString *)text successfully:(BOOL)flag;
47
48@end
49
53@protocol TNKAudioPlayerProtocol <NSObject>
54
58@property (nonatomic, weak) id <TNKAudioPlayerDelegate> delegate;
59
63@property (nonatomic, readonly) BOOL isPlaying;
64
69@property (nonatomic, assign) float volume;
70
75@property (nonatomic, assign) int rate;
76
81- (void)playWithRate:(TNKAudioPlayRateType)type;
82
87- (void)playWithAudioParam:(TNKAudioParam *)audioParam;
88
93- (void)playWithNaviTTS:(TNKNavTTS *)naviTTS;
94
98- (void)stop;
99
103- (BOOL)stateInterruption;
104
108- (void)mutePlayer;
109
113- (void)unmutePlayer;
114
118- (BOOL)isPlayerMute;
119
120@end
121
123@interface TNKAudioParam : NSObject
124
128@property (nonatomic, copy) NSString *text;
129
133@property (nonatomic, assign) int playOption;
134
135
136@end
137
138NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSUInteger, TNKAudioPlayRateType)
Definition: TNKAudioPlayerProtocol.h:14
播报信息.
Definition: TNKAudioPlayerProtocol.h:124
int playOption
播报策略。0为打断当前正在播报的内容,并播报改内容;1为排队,当前播报完毕后播报该内容
Definition: TNKAudioPlayerProtocol.h:133
NSString * text
播报内容
Definition: TNKAudioPlayerProtocol.h:128
TTS播报内容
Definition: TNKNavTTS.h:33
内置语音播报器事件回调.
Definition: TNKAudioPlayerProtocol.h:26
语音播报器协议
Definition: TNKAudioPlayerProtocol.h:53
void unmutePlayer()
解除静音.
BOOL isPlayerMute()
当前是否静音.
BOOL isPlaying
语音播报器是否在播放状态.
Definition: TNKAudioPlayerProtocol.h:63
id< TNKAudioPlayerDelegate > delegate
TNKAudioPlayer的回调. 用于接收播报状态等事件.
Definition: TNKAudioPlayerProtocol.h:58
BOOL stateInterruption()
当前播报中断态.
void mutePlayer()
设置成静音.
void stop()
停止当前播报内容.
int rate
控制语音播报速度,请在开始播报之前设置完成设置范围[20, 100],默认是50是正常速度(不设置该属性默认也是正常速度),最大支持100是双倍速度
Definition: TNKAudioPlayerProtocol.h:75
float volume
控制音量,设置范围[0, 1]T
Definition: TNKAudioPlayerProtocol.h:69