我有一个应用程序在UIWebView中播放Youtube和Vimeo等几个webvideos.播放视频时,可以通过AirPlay将其发送到Apple TV.
目前,在通过AirPlay播放期间,当我暂停应用并将其移至后台时,视频会停止.
我希望的结果是视频将继续在Apple TV上播放.
经过一些研究,我发现我必须Required background modes在Info.plist中设置App plays audio.不幸的是,这不起作用.
因此,当应用程序移动到后台时,需要设置什么来保持视频在AirPlay上播放.
我在swift游戏中为tvOS添加了一些按钮.
override func didMoveToView(view: SKView) {
let button1=UIButton(frame: CGRectMake(330, 800, 300, 100))
button1(imageBuySelected, forState: UIControlState.Focused)
button1(imageBuyNormal, forState: UIControlState.Normal
button1 = UIColor.clearColor()
button1(self, action: "buy1", forControlEvents: UIControlEvents.PrimaryActionTriggered)
self.view!.addSubview(button1)
let button2=UIButton(frame: CGRectMake(330, 800, 300, 100))
button2(imageBuySelected, forState: UIControlState.Focused)
button2(imageBuyNormal, forState: UIControlState.Normal
button2 = UIColor.clearColor()
button2(self, action: "buy2", forControlEvents: UIControlEvents.PrimaryActionTriggered)
self.view!.addSubview(button2)
let button3=UIButton(frame: CGRectMake(330, 800, 300, 100))
button3(imageBuySelected, forState: UIControlState.Focused)
button3(imageBuyNormal, forState: UIControlState.Normal
button3 = UIColor.clearColor()
button3(self, action: "playGame", forControlEvents: UIControlEvents.PrimaryActionTriggered)
self.view!.addSubview(button3)
}
Run Code Online (Sandbox Code Playgroud)
比赛开始时.初始焦点设置为button1.我希望将焦点设置为button3.我知道首选焦点是根据从屏幕左上角开始找到的第一个可聚焦对象自动选择的.有没有人知道如何覆盖这个,所以我可以在游戏开始时使button3成为preferredfocusview?
也许有人可以提供帮助,我正在尝试移动我的应用以促进Apple TV的新目标.我创建了新的Storyboard,并以与iOS应用程序相同的方式链接了所有内容.当我尝试启动应用程序时,在AppDelegate执行之后(在进入viewDidLoad初始控制器之前),我得到以下异常.
有任何想法吗?
2015-09-19 12:24:44.629 App TV[46733:3797033] *** Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CATransformLayer: 0x7fc1e0d51fc0> is a part of cycle in its layer tree'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e850105 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010f271deb objc_exception_throw + 48
2 CoreFoundation 0x000000010e85003d +[NSException raise:format:] + 205
3 QuartzCore 0x0000000111d2f74a _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 102
4 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
5 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
6 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + …Run Code Online (Sandbox Code Playgroud) 查看新Apple TV的TVOS文档和模板示例,我看到有徽章可供您使用资源. 例:
<badge src="resource://mpaa-pg" class="badge" />
<badge src="resource://button-play" />
<badge src="resource://cc" class="badge" />
Run Code Online (Sandbox Code Playgroud)
有人知道在哪里可以找到所有可用资源的列表吗?我在文档中找不到它.谢谢.
我想创建一个应用程序,用户不知道附近设备的发现(如iphone,ipad和appletv等),并选择唯一的appleTv,如果在附近可用,然后原子连接并启动镜像.为此我读了AirPlay:
使用AirPlay,用户将音频和视频从iTunes或基于iOS的设备重定向到Apple TV(从那里到家庭影院系统)或AirPlay启用的音响系统.AirPlay可以流式传输来自互联网的媒体,已存储在iTunes中的媒体或存储在基于iOS的设备上的媒体.AirPlay可以在iOS应用程序,基于iOS的设备上的Safari浏览器或任何平台的iTunes中播放基于Internet的媒体
但我不需要airplay按钮,我想以编程方式发现设备并仅与appleTv连接,然后开始镜像.
我阅读了很多博客并搜索过很多东西,但没有找到任何有用的东西.http://spin.atomicobject.com/2012/04/23/ios-mirroring-and-programmatic-airplay-selection/ 给出了一些解释,但它出现了.
请给我一些建议,如何以一种伟大的方式实现这种东西.
我正在研究apple tv os应用程序.我想把重点放在特定的UiButton上,但我不知道如何使用preferredFocusEnvironments而不是preferredFocusedView?
我可以使用preferredFocusedView但不推荐使用此变量.
所以任何人都可以帮我解决这个问题?
我需要指定哪个单元格应该获得焦点.
根据Apple文档,indexPathForPreferredFocusedView如果remembersLastFocusedIndexPath属性是false,或者如果没有保存的索引路径,则应调用委托方法,因为之前没有单元格.
在我的情况下,我在a中使用集合视图UIViewController并设置remembersLastFocusedIndexPath为false但indexPathForPreferredFocusedView未被调用.
怎么解释这个行为?
当尝试将 Xcode 与我的 Apple TV 配对时,它显示
该设备已在设备面板中被忽略。
在这个问题得到解决之前,我无法继续正常开发,但是我找不到取消忽略的按钮。请帮助我,谢谢!
在tvOS中,有一个集合视图.每个"行"是一个图像.每个图像都有与之关联的文本.当用户"悬停"在图像上时,文本将更改为与图像匹配.但是,我希望用户能够转到文本而不将焦点放在所选图像和UITextView之间的图像之间.
使用播放/暂停按钮,我可以切换UITextView的背景颜色,但UITextView无法获得焦点.用户必须使用遥控器来选择UTTextView.
这是代码:
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIEvent *)event {
for (UIPress *item in presses)
{
if(item.type == UIPressTypePlayPause) {
//should reactivate uicollectionview
if (_isPlay) {
_isPlay = NO;
_artistsCollectionView.userInteractionEnabled = YES;
_textViewForBiosAndHelp.backgroundColor = [UIColor lightGrayColor];
[_textViewForBiosAndHelp resignFirstResponder];
[_artistsCollectionView becomeFirstResponder];
[_artistsCollectionView preferredFocusedView];
//the purpsoe is to go to the textview. it does not.
}else{
_isPlay = YES;
_artistsCollectionView.userInteractionEnabled = NO;
_textViewForBiosAndHelp.backgroundColor = _aColor;
[_artistsCollectionView resignFirstResponder];
[_textViewForBiosAndHelp becomeFirstResponder];
[ _textViewForBiosAndHelp preferredFocusedView];
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我在哪里可以找到xcode或sim中tvos javascript的控制台输出?答案可能微不足道,但我无法弄明白.谢谢你的耐心.
apple-tv ×10
tvos ×8
ios ×4
airplay ×2
xcode ×2
focus ×1
javascript ×1
objective-c ×1
sprite-kit ×1
swift ×1
swift2 ×1
tvos10 ×1
tvos9.1 ×1