2015-04-04 83 views

回答

3

當前版本的WatchKit(8.2)不支持視頻。可以創建動畫系列圖像並在Watch上播放它們,但存儲和傳輸成本可能意味着此「視頻」將會很短並且幀速率較低。據推測,這是他們在其中一個主題演示中用來顯示車庫門視頻的技術。

+1

其實,你可以使用私有API播放視頻,但你會被拒絕。所以我認爲不太相關。 你知道系列照片技術可以達到多少FPS嗎? – Idan 2015-04-04 16:28:56

+1

鑑於它與Watch上的所有動畫使用的技術相同,我的猜測是它可以是30fps(儘管對於視頻幀,由於它們的相對有效負載大小,這可能是矯枉過正)。如果你打算在拍攝時發送幀,我相信這個數字會每秒或更快地下降到一幀。 – 2015-04-04 17:12:14

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() 
    } 

} 
相關問題