123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- //
- // MKRWIFIDeviceManager.h
- // MKRAVPlayer
- //
- // Created by yyqxiaoyin on 2019/4/16.
- //
- #import <Foundation/Foundation.h>
- #import "MKRUPnPDevice.h"
- #import "MKRM3UListModel.h"
- #import "MKRRadioResorce.h"
- #define _MKRWIFIDeviceManager [MKRWIFIDeviceManager shareManager]
- @protocol MKRWIFIDeviceManagerDelegate <NSObject>
- @optional
- /** 已经搜索到的设备数组发生改变 */
- - (void)currentDevicesChange:(NSArray <NSDictionary *> *)deviceArray;
- /** 搜索到新设备 */
- - (void)didSearchNewDevice:(NSDictionary *)newDecice;
- @end
- @interface MKRWIFIDeviceManager : NSObject
- + (instancetype)shareManager;
- @property (nonatomic, strong)NSString *userID;
- - (void)addDeviceManagerListener:(id<MKRWIFIDeviceManagerDelegate>)listener;
- - (void)removeDeviceManagerListener:(id<MKRWIFIDeviceManagerDelegate>)listener;
- /**
- * 初始化UPNP
- * @return UPNP初始化错误码 0为无错误 即初始化成功
- */
- - (NSInteger)startUpnp;
- /**
- * 搜索设备
- * @param searchTime 搜索时长
- * @param timeBlock 搜索回调 每秒在主线程回调一次
- */
- - (void)searchDeviceWithSearchTime:(int)searchTime
- timeBlock:(void(^)(NSInteger time,NSArray <NSDictionary *>*devices))timeBlock;
- /**
- * 生成m3u列表
- * @param m3uListModel m3u列表模型
- */
- - (void)setM3UList:(MKRM3UListModel *)m3uListModel;
- /**
- * 设置设备单首播放的资源
- * @param song 需要播放的资源
- * @param device 需要设置的设备
- * @param userID 用户ID
- */
- - (void)setAVTransportURIWithSong:(id <MKRRadioResorce>)song
- device:(id <MKRUPnPDevice>)device
- userID:(NSString *)userID;
- /**
- * 播放
- * @param device 设备
- */
- - (void)playWithDevice:(id <MKRUPnPDevice>)device;
- /**
- * 播放channelNO频道从第index开始
- * 在播放之前 如果是临时频道(频道号>= 12) 需要先生成M3U列表
- * 如是正式频道(频道号 0~11) 可选生成M3U
- * @param channelNO 频道号
- * @param index 需要播放的下标
- * @param device 播放的设备
- * @param userID 用户ID
- */
- - (void)playSongWithChannelNO:(NSInteger)channelNO
- index:(NSInteger)index
- device:(id <MKRUPnPDevice>)device
- userID:(NSString *)userID;
- /**
- * 播放channelNO频道 从第0首开始
- * @param channelNO 频道号
- * @param device 需要播放的设备
- * @param userID 用户ID
- */
- - (void)playSongWithChannelNO:(NSInteger)channelNO
- device:(id <MKRUPnPDevice>)device
- userID:(NSString *)userID;
- /**
- * 暂停
- * @param device 设备
- */
- - (void)pauseWithDevice:(id <MKRUPnPDevice>)device;
- /**
- * 下一首
- * @param device 设备
- */
- - (void)nextWithDevice:(id <MKRUPnPDevice>)device;
- /**
- * 上一首
- * @param device 设备
- */
- - (void)previousWithDevice:(id <MKRUPnPDevice>)device;
- /**
- * 停止
- * @param device 设备
- */
- - (void)stopWithDevice:(id <MKRUPnPDevice>)device;
- /**
- * 设置音量
- * @param volume 音量值 1~100
- * @param device 设备
- */
- - (void)setVolume:(int)volume device:(id <MKRUPnPDevice>)device;
- /**
- * 快进到timeInterval 的进度
- * @param timeInterval 快进/快退目标秒数
- * @param device 需要快进的设备
- */
- - (void)seekToTimeInterval:(NSInteger)timeInterval device:(id <MKRUPnPDevice>)device;
- /**
- * 清空设备中的其中一个频道
- * @param channelNO 频道号
- * @param device 设备
- */
- - (void)clearChannelWithChannelNO:(NSString *)channelNO device:(id <MKRUPnPDevice>)device;
- - (id <MKRRadioResorce>)getPlayingStatusWithDevice:(id <MKRUPnPDevice>)device;
- @end
|