2016-12-02 51 views

回答

0

請閱讀文檔Apple document。那些支持

視頻技術是MOVM4VMP43GP

所以.wmv文件無法播放。

如果你在這個如此有興趣看看source code

iTunes的鏈接,同樣Elevan player

+0

感謝您的回覆。除了轉換爲mp4格式,是否還有其他選項可用 –

+0

@Rakesh它在我給出的源代碼中實現。請遵循。謝謝 – Saranjith

+0

如果您清楚,請接受答案 – Saranjith

0

WMV文件無法播放。

但是你可以在後臺將wmv轉換爲mp4然後播放它。

以下是轉換代碼。

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"MyVideo.mp4"]; 
NSURL *outputURL = [NSURL fileURLWithPath:filePath]; 

[self convertVideoToLowQuailtyWithInputURL:localUrl outputURL:outputURL handler:^(AVAssetExportSession *exportSession) 
{ 
    if (exportSession.status == AVAssetExportSessionStatusCompleted) { 
     // Video conversation completed 
    }   
}]; 

- (void)convertVideoToLowQuailtyWithInputURL:(NSURL*)inputURL outputURL:(NSURL*)outputURL handler:(void (^)(AVAssetExportSession*))handler { 
    [[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil]; 
    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:inputURL options:nil]; 
    AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetPassthrough]; 
    exportSession.outputURL = outputURL; 
    exportSession.outputFileType = AVFileTypeMPEG4; 
    [exportSession exportAsynchronouslyWithCompletionHandler:^(void) { 
     handler(exportSession); 
    }]; 
}