Javascript Chromecast-连接或启动前检查
我正在使用Kevin Nilson在GitHub上主持的示例 首先,如果这听起来有点奇怪或者没有必要这样做,我很抱歉,但我有这个问题要解决 我试图做的是,如果某个用户已经在电视上观看/播放媒体,则拒绝访问/连接 现在是这样,我未来的目标是创建一个队列来管理大量用户,让我解释一下: 在一个有一台电视和一台Chromecast的家庭中,家庭/用户共享同一个网络并希望在同一台电视上播放节目,我如何在不断开活动用户连接的情况下进行管理 从设备(iPhone)上,至少可以发出警告说“你将要断开某人的iPhone”-是或不是 我不知道我是否必须在发送器中实现这一点,如下图所示,还是在带有JavaScript的接收器中实现这一点 谢谢你抽出时间 (更新)Javascript Chromecast-连接或启动前检查,javascript,objective-c,chromecast,Javascript,Objective C,Chromecast,我正在使用Kevin Nilson在GitHub上主持的示例 首先,如果这听起来有点奇怪或者没有必要这样做,我很抱歉,但我有这个问题要解决 我试图做的是,如果某个用户已经在电视上观看/播放媒体,则拒绝访问/连接 现在是这样,我未来的目标是创建一个队列来管理大量用户,让我解释一下: 在一个有一台电视和一台Chromecast的家庭中,家庭/用户共享同一个网络并希望在同一台电视上播放节目,我如何在不断开活动用户连接的情况下进行管理 从设备(iPhone)上,至少可以发出警告说“你将要断开某人的iPh
您应该遵守演员设计检查表,不要更改演员按钮的行为。谢谢@Leonnichols,但演员设计检查表中有“当演员接收器可用时”,技术上是可用的,但如果有人按下按钮连接,并且有人已经看到媒体,他们在没有任何警告的情况下断开连接,这是我需要解决的问题。这就是该产品目前的工作方式。谢谢,该产品很棒,我喜欢它,但我只是认为它将是一个很好的功能,你呢?我真的很想继续,你能告诉我怎么做吗?
- (void)connectToDevice:(GCKDevice *)device {
NSLog(@"Device address: %@:%d", device.ipAddress, (unsigned int) device.servicePort);
self.selectedDevice = device;
NSDictionary *info = [[NSBundle mainBundle] infoDictionary];
NSString *appIdentifier = [info objectForKey:@"CFBundleIdentifier"];
self.deviceManager =
[[GCKDeviceManager alloc] initWithDevice:self.selectedDevice clientPackageName:appIdentifier];
self.deviceManager.delegate = self;
// check if someone is already connected or playing media ...
// the problem here is than I only can disconnect my own device
if (_streamDuration > 0) { // if the current stream duration is greater than 0 ...
// than disconnect
[self.deviceManager leaveApplication];
[self.deviceManager disconnect];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"You are about to disconnect iPhone of Someone" delegate:self cancelButtonTitle:@"Not" otherButtonTitles:@"Ok", nil];
[alert show];
//reset the button status ...
// connect
} else {
[self.deviceManager connect];
}
// Start animating the cast connect images.
UIButton *chromecastButton = (UIButton *)self.chromecastBarButton.customView;
chromecastButton.tintColor = [UIColor whiteColor];
chromecastButton.imageView.animationImages =
@[ [UIImage imageNamed:@"icon_cast_on0.png"], [UIImage imageNamed:@"icon_cast_on1.png"],
[UIImage imageNamed:@"icon_cast_on2.png"], [UIImage imageNamed:@"icon_cast_on1.png"] ];
chromecastButton.imageView.animationDuration = 2;
[chromecastButton.imageView startAnimating];
}