我讀過一些文章,但沒有找到我需要的答案:是否可以在WatchKit應用程序中播放視頻文件或URL中的視頻?在WatchKit應用程序中播放視頻
2
A
回答
3
當前版本的WatchKit(8.2)不支持視頻。可以創建動畫系列圖像並在Watch上播放它們,但存儲和傳輸成本可能意味着此「視頻」將會很短並且幀速率較低。據推測,這是他們在其中一個主題演示中用來顯示車庫門視頻的技術。
1
當前版本的WatchOS 2.0允許播放視頻,但只允許本地播放。請參閱WKInterfaceMovie
類參考:https://developer.apple.com/library/prerelease/watchos/documentation/WatchKit/Reference/WKInterfaceMovie_class/index.html#//apple_ref/occ/cl/WKInterfaceMovie
0
我在分享objective-c和swift代碼塊。但前面的評論解釋說。視頻只播放本地視頻。
Objective-C的
#import "InterfaceController.h"
@interface InterfaceController()
@end
@implementation InterfaceController
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
// Configure interface objects here.
}
- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[super willActivate];
NSURL* url = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"mov"];
[self.myMoviePlayer setMovieURL:url];
}
- (void)didDeactivate {
// This method is called when watch view controller is no longer visible
[super didDeactivate];
}
@end
斯威夫特
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBOutlet var myMoviePlayer: WKInterfaceMovie!
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
let url = NSBundle.mainBundle().URLForResource("test", withExtension: "mov")
self.myMoviePlayer.setMovieURL(url!)
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}
相關問題
- 1. 在iPhone應用程序中播放視頻庫中的視頻
- 2. 在原生視頻應用程序中播放視頻URL WinRT
- 3. 播放mp4視頻android應用程序
- 4. 視頻播放器應用程序
- 5. C++在控制檯應用程序中播放視頻音頻
- 6. 在視頻播放中播放視頻
- 7. 如何使用手機的視頻播放器應用程序播放視頻
- 8. iphone應用程序:僅在小視圖中播放視頻
- 9. 在Rails應用程序中播放視頻在紅寶石中
- 10. 在Android中播放youtube視頻在應用程序中
- 11. 在Android應用程序中播放項目中的視頻
- 12. 在iOS中的應用程序中播放錄製的視頻
- 13. 如何在UIView在iOS應用程序中播放視頻流?
- 14. 在VideoView中播放Youtube視頻(在應用程序內)
- 15. 如何在C++應用程序中播放和播放Youtube/FLV視頻?
- 16. 在iOS應用程序中錄製視頻,立即播放並循環播放
- 17. 如何在我的android應用程序中播放管視頻
- 18. 無法在我的Android應用程序中播放YouTube視頻
- 19. 在windows C++應用程序中播放視頻剪輯
- 20. 在iPhone應用程序中播放youtube視頻
- 21. 在Java桌面應用程序中播放視頻
- 22. 在我的應用程序中本地播放視頻
- 23. 如何在Silverlight應用程序中播放youtube視頻?
- 24. 在Android應用程序中播放YouTube視頻
- 25. 在HTML/JS AIR應用程序中播放視頻
- 26. 如何在Windows Phone應用程序中播放視頻
- 27. 在遊戲應用程序中播放視頻
- 28. 暫停並在WPF應用程序中播放視頻
- 29. 在AIR應用程序(AS3)中播放YouTube視頻
- 30. 在ios應用程序中播放Facebook視頻
其實,你可以使用私有API播放視頻,但你會被拒絕。所以我認爲不太相關。 你知道系列照片技術可以達到多少FPS嗎? – Idan 2015-04-04 16:28:56
鑑於它與Watch上的所有動畫使用的技術相同,我的猜測是它可以是30fps(儘管對於視頻幀,由於它們的相對有效負載大小,這可能是矯枉過正)。如果你打算在拍攝時發送幀,我相信這個數字會每秒或更快地下降到一幀。 – 2015-04-04 17:12:14