回答編集履歴
2
追記しました。
answer
CHANGED
@@ -15,4 +15,13 @@
|
|
15
15
|
```
|
16
16
|
|
17
17
|
参考記事
|
18
|
-
[https://joyplot.com/documents/2016/11/03/swift-fileurl-path/](https://joyplot.com/documents/2016/11/03/swift-fileurl-path/)
|
18
|
+
[https://joyplot.com/documents/2016/11/03/swift-fileurl-path/](https://joyplot.com/documents/2016/11/03/swift-fileurl-path/)
|
19
|
+
|
20
|
+
【追記】
|
21
|
+
```
|
22
|
+
let fm = FileManager.default
|
23
|
+
let url = try! fm.url(for:.documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
|
24
|
+
let path = url.appendingPathComponent("video.mp4")
|
25
|
+
|
26
|
+
let videoPlayer = AVPlayer(url: URL(fileURLWithPath: path)!)
|
27
|
+
```
|
1
一箇所修正しました
answer
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
let dir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last!
|
12
12
|
let path = "(dir)/video.mp4"
|
13
13
|
|
14
|
-
let videoPlayer = AVPlayer(url: URL(fileURLWithPath: path))
|
14
|
+
let videoPlayer = AVPlayer(url: URL(fileURLWithPath: path)!)
|
15
15
|
```
|
16
16
|
|
17
17
|
参考記事
|