下载SDK
在Build Setting中Other Linker Flags添加-ObjC
Bulid Phases添加系统类库
引入头文件
#import <HPCastLink/HPCastLink.h>
#import <HPCastLink/HPDevicesService.h>
添加代理
<HPCastSearchDelegate, HPCastLinkDelegate>
在viewDidLoad中
[[HPCastLink sharedCastLink]appkeyVerify:@"<#AppKey#>"];
[HPCastLink sharedCastLink].delegate = self;
[HPCastLink sharedCastLink].enableDLNA = YES;
[[HPCastLink sharedCastLink]setBackgroundPlay:NO];
[[HPCastLink sharedCastLink]castServiceDiscoveryDelegate:self];
[[HPCastLink sharedCastLink]castServiceDiscoveryBlock:^(NSArray *response) {
[self.dataArray removeAllObjects];
[self.dataArray addObjectsFromArray:response];
[self.tableView reloadData];
[[HPCastLink sharedCastLink]castServiceStopDiscovery];
}];
[[HPCastLink sharedCastLink]castStartPlay:HPCastMediaTypeVideo url:@"http://demon-1252098972.costj.myqcloud.com/562151.MOV" startPosition:0 superViewController:self completeBlock:^(HPCastMirrorResults response) {
NSLog(@"%lu",(unsigned long)response); NSLog(@"==============%d",[HPCastLink sharedCastLink].isMirrorTv);
[[HPCastLink sharedCastLink]castDeviceVolume:0];
}];
[听雨阁](http://www.ledemon.top)