反向控制
引用头文件 <XYServiceSDK/XYSDK+ReverseController.h>
并使用以下接口:
音乐点播
+ (void)reverseOperationStartMusicAOD:(NSDictionary *_Nonnull)info
Completion:(void(^_Nullable)(NSDictionary * _Nullable statusInfo, NSError * _Nullable error))completion;
info: 音乐资源信息,NSDictionary类型,需传入"albumId"和"trackId"
FM点播
+ (void)reverseOperationStartFMAOD:(NSDictionary *_Nonnull)info
Completion:(void(^_Nullable)(NSDictionary * _Nullable statusInfo, NSError * _Nullable error))completion;
info: 音乐资源信息,NSDictionary类型,需传入"albumId"和"trackId"
暂停
+ (void)reverseOperationPauseCompletion:(void(^_Nullable)(NSDictionary * _Nullable statusInfo, NSError * _Nullable error))completion;
继续播放
+ (void)reverseOperationPlayCompletion:(void(^_Nullable)(NSDictionary * _Nullable statusInfo, NSError * _Nullable error))completion;
上一曲
+ (void)reverseOperationPreviousCompletion:(void(^_Nullable)(NSDictionary * _Nullable statusInfo, NSError * _Nullable error))completion;
下一曲
+ (void)reverseOperationNextCompletion:(void(^_Nullable)(NSDictionary * _Nullable statusInfo, NSError * _Nullable error))completion;
设置音量
+ (void)reverseOperationVolume:(NSInteger)volume
completion:(void(^_Nullable)(NSDictionary * _Nullable statusInfo, NSError * _Nullable error))completion;
volume: 音量值,NSInteger类型,数值0-10
音箱播放状态
为实时地获取音箱当前播放状态,需使用OVSReverseControlProtocol协议,引用 <XYServiceSDK/OVSReverseController.h>
头文件,实现代理[OVSReverseController shareInstance].delegate = self
并通过以下方法监听结果:
- (void)notifyReverseDeviceStatusInfo:(NSDictionary *)info;
deviceStatusInfo:
字段 | 类型 | 描述 |
---|---|---|
bluetoothStatus | BOOL | 蓝牙状态 |
volume | NSInteger | 音量数值 |
onlineStatus | BOOL | 音箱在线状态 |
networkStatus | BOOL | 网络状态 |
micStatus | BOOL | 网络状态 |
action_vod.artist | NSString | 专辑的作者 |
action_vod.track_id | NSString | 当前资源id |
action_vod.track | NSString | 当前资源标题 |
action_vod.album_id | NSString | 专辑id |
action_vod.album_id | NSString | 专辑标题 |
action_vod.bg_img_small | NSString | 封面图url |