我從服務器獲取視頻數據播放使用視頻數據的視頻。我正在使用signalR框架。首先我從iPhone照片庫捕捉視頻。然後接下來我轉換編碼格式(base64EncodedStringwithOptions
)的方法。接下來我將視頻加密數據發送到signalR服務器。接下來我正在接收視頻數據並使用AVPlayer
解密並播放視頻數據。但我的問題視頻不播放。但是我收到了來自signalR的視頻數據。解密我使用這種方法。 (NSDataBase64DecodingIgnoreUnknownCharacters
)如何在iOS的
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentDirectory = [paths objectAtIndex:0];
NSString *videoFile=[documentDirectory stringByAppendingPathComponent:post.mediaName];
NSURL *url;
if ([[NSFileManager defaultManager] fileExistsAtPath:videoFile]) {
url=[NSURL URLWithString:videoFile];
}
NSLog(@"Video URL is:%@",url);
AVPlayer *player = [AVPlayer playerWithURL:url];
cell.videoPlayerController.player = player;
[player play];
我有視頻網址是這樣的:
Video URL is:/Users/Library/Developer/CoreSimulator/Devices/EEC96DE7-6D0F-4D80-82B8-3C24E4F6B3EF/data/Containers/Data/Applicatication video0006.mp4
我們e MPMoviePlayerViewController –
@AnjaliBhimani感謝您的回覆..我正在使用MPMoviePlayerViewController ..但它不工作。 – satya
你正在得到什麼錯誤?你可以請在這裏添加你的代碼 –