我正在使用Xcode 7並且快速查看功能時遇到此錯誤。它說的「fileURL」無法加載快看這裏的數據是我的代碼 //因爲下面一行@file被貼在我fileURL像這樣結束了 -由於fileURLWithPath方法無法加載「fileURL」無法播放AVPlayer視頻的快速查看數據
@"http:/example.com/some_clips/SHAINA%20NC%20NEWS%20X%20180516%201657PM.mp4 -- file:///" see here something file:/// in the end so because of this i am unable to play video.
如果我使用initWithString和直接給URL,然後給出沒有錯誤,請建議我給我的播放器設置URL以下我已創建請在代碼中閱讀評論也。有沒有人有這個想法。
NSString *localfilepath=[NSString stringWithFormat:@"%@",[managedObject valueForKey:@"clip_path"]]; //here i am getting my URL path upto .mp4 but after below line word -- file gets attached to it because of fileURLWithPath method don't know how to convert that
NSURL *fileURL = [NSURL fileURLWithPath:localfilepath]; //suggest me this line of code so that i can pass URL to the player here this method is not working
// create a player
player = [AVPlayer playerWithURL:fileURL]; //here this fileURL which is going to player is going with that file:/// so giving error and no video runs
AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];
[self addChildViewController:controller];
[self.view addSubview:controller.view];
controller.view.frame = CGRectMake(10,80,300,300);
controller.player = player;
controller.showsPlaybackControls = YES;
[player pause];
'[managedObject valueForKey:@ 「clip_path」]'類? – Larme
它是從哪裏獲取URL的核心數據剪輯的路徑@Larme – vicky
我已經做到了:)我發現它們只是一行代碼只需要在NSUTF8StringEncoding格式中編碼該字符串我將編寫完整的解決方案對此答案 – vicky