質問編集履歴
15
回答に対する返答
test
CHANGED
File without changes
|
test
CHANGED
@@ -253,3 +253,9 @@
|
|
253
253
|
|
254
254
|
|
255
255
|
![fatal error](83594e3c223266431f1c3d63f80054b5.png)
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
![Project image](f5ca32c756138803eb7ce2101116c66b.png)
|
14
回答に対する返答
test
CHANGED
File without changes
|
test
CHANGED
@@ -249,3 +249,7 @@
|
|
249
249
|
|
250
250
|
|
251
251
|
IBOutletで宣言したものを画像のように紐付けています
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
![fatal error](83594e3c223266431f1c3d63f80054b5.png)
|
13
回答に対する返答
test
CHANGED
File without changes
|
test
CHANGED
@@ -237,3 +237,15 @@
|
|
237
237
|
}
|
238
238
|
|
239
239
|
```
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
![playerview](95315bf49fd51e307aaae64747dbf9a8.png)
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
![iboutlet](2a012c7903dd2e1b67ac4cdf906158a1.png)
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
IBOutletで宣言したものを画像のように紐付けています
|
12
回答に対する返答
test
CHANGED
File without changes
|
test
CHANGED
@@ -77,3 +77,163 @@
|
|
77
77
|
|
78
78
|
|
79
79
|
どうすれば正しく取得できるのでしょうか?
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
追記
|
86
|
+
|
87
|
+
動画viewコード
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
```ここに言語を入力
|
92
|
+
|
93
|
+
import UIKit
|
94
|
+
|
95
|
+
import youtube_ios_player_helper
|
96
|
+
|
97
|
+
import AVFoundation
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
class ViewController: UIViewController, YTPlayerViewDelegate{
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
@IBOutlet var playerView: YTPlayerView!
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
var appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
override func viewDidLoad() {
|
118
|
+
|
119
|
+
super.viewDidLoad()
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
///self.playerView?.delegate = self
|
124
|
+
|
125
|
+
self.playerView.delegate = self
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
//self.playerView?.sizeToFit()
|
130
|
+
|
131
|
+
self.playerView.sizeToFit()
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
player()
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
let audioSession = AVAudioSession.sharedInstance()
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
do {
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
try audioSession.setCategory(AVAudioSessionCategoryPlayback)
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
catch {
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
print("")
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
func playerViewDidBecomeReady(_ playerView: YTPlayerView) {
|
178
|
+
|
179
|
+
playerView.playVideo()
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
func play() {
|
186
|
+
|
187
|
+
print("Push! play")
|
188
|
+
|
189
|
+
//playerView.stopVideo()
|
190
|
+
|
191
|
+
//playerView.delegate = self
|
192
|
+
|
193
|
+
//self.playerView = YTPlayerView()
|
194
|
+
|
195
|
+
playerView.load(withVideoId: self.appDelegate.selectMV)
|
196
|
+
|
197
|
+
playerView.playVideo()
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
func player(){
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
let vars = ["playsinline": 1, "controls": 2, "showinfo": 0, "origin":"https://www.google.com"] as [String : Any]
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
if self.appDelegate.selectMV == ""
|
214
|
+
|
215
|
+
{
|
216
|
+
|
217
|
+
print("Not load",self.appDelegate.selectMV)
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
else
|
222
|
+
|
223
|
+
{
|
224
|
+
|
225
|
+
print("Loaded",self.appDelegate.selectMV)
|
226
|
+
|
227
|
+
playerView.load(withVideoId: self.appDelegate.selectMV, playerVars: vars)
|
228
|
+
|
229
|
+
print("Check this",playerView)
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
```
|
11
エラー箇所の修正 質問の見直し
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
他
|
1
|
+
他Viewから(YTPlayer)の取得したい。
|
test
CHANGED
@@ -2,17 +2,9 @@
|
|
2
2
|
|
3
3
|
下を動画を選択するnavigationを用いたtableviewで実装しています。
|
4
4
|
|
5
|
-
|
5
|
+
|
6
6
|
|
7
7
|
![SongVCTで動画選択画面](fd383aca2da9478703f447dedc255a33.png)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
上の画像の通りSongVCTで動画選択後に選択された動画情報をstringでViewConに渡してそれをViewConで再生したいのですが。
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
SongVCTからViewConを制御するにはどうしたらよいでしょうか?
|
16
8
|
|
17
9
|
|
18
10
|
|
@@ -20,31 +12,13 @@
|
|
20
12
|
|
21
13
|
|
22
14
|
|
23
|
-
|
24
|
-
|
25
|
-
以下どうにか再生しようとして試した方法です。
|
26
|
-
|
27
|
-
SongVC
|
15
|
+
SongTVC(下のtableviewcon)からVideoviewCon(上のviewcon)を制御するために
|
28
|
-
|
29
|
-
どうすればplayerView(YTplayer)を取得できますでしょうか?
|
30
16
|
|
31
17
|
|
32
18
|
|
33
|
-
|
19
|
+
SongVCTで
|
34
20
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
以下SongVCTのセルタップ動作
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
```
|
21
|
+
```ここに言語を入力
|
48
22
|
|
49
23
|
// Cell が選択された場合
|
50
24
|
|
@@ -56,65 +30,11 @@
|
|
56
30
|
|
57
31
|
self.appDelegate.selectMV = self.appDelegate.videoIDAR[indexPath.row]
|
58
32
|
|
59
|
-
print("",self.appDelegate.selectMV)
|
60
33
|
|
61
34
|
|
62
|
-
|
63
|
-
let parent = storyboard!.instantiateViewController(withIdentifier: "player");
|
64
|
-
|
65
|
-
parent.viewDidLoad()
|
66
|
-
|
67
|
-
//ViewConのviewdidload再読込
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
}
|
74
|
-
|
75
|
-
```
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
ViewConのコード
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
```Swift3
|
84
|
-
|
85
|
-
import UIKit
|
86
|
-
|
87
|
-
import youtube_ios_player_helper
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
class ViewController: UIViewController, YTPlayerViewDelegate{
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
@IBOutlet weak var playerView: YTPlayerView?
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
var appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
35
|
+
let video = ViewController()
|
104
|
-
|
105
|
-
super.viewDidLoad()
|
106
36
|
|
107
37
|
|
108
|
-
|
109
|
-
///self.playerView?.delegate = self
|
110
|
-
|
111
|
-
playerView?.delegate = self
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
//self.playerView?.sizeToFit()
|
116
|
-
|
117
|
-
playerView?.sizeToFit()
|
118
38
|
|
119
39
|
|
120
40
|
|
@@ -122,40 +42,38 @@
|
|
122
42
|
|
123
43
|
|
124
44
|
|
125
|
-
i
|
45
|
+
video.playerView!.load(withVideoId: self.appDelegate.selectMV, playerVars: vars)
|
126
46
|
|
127
|
-
{
|
128
|
-
|
129
|
-
print("Not good",self.appDelegate.selectMV)
|
130
|
-
|
131
|
-
}
|
132
|
-
|
133
|
-
else
|
134
|
-
|
135
|
-
{
|
136
|
-
|
137
|
-
print("Ok good",self.appDelegate.selectMV)
|
138
|
-
|
139
|
-
//playerView!でfatal error: unexpectedly found nil while unwrapping an Optional value
|
140
|
-
|
141
|
-
|
47
|
+
video.playerView!.playVideo()
|
142
|
-
|
143
|
-
playerView!.load(withVideoId: self.appDelegate.selectMV, playerVars: vars)
|
144
|
-
|
145
|
-
}
|
146
48
|
|
147
49
|
|
148
50
|
|
149
51
|
}
|
150
52
|
|
151
|
-
|
152
53
|
|
153
|
-
func playerViewDidBecomeReady(_ playerView: YTPlayerView) {
|
154
54
|
|
155
|
-
playerView.playVideo()
|
156
55
|
|
157
|
-
}
|
158
56
|
|
159
|
-
|
57
|
+
|
160
58
|
|
161
59
|
```
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
と実装したのですが
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
![Error](9bc0351dcb98f361408222eab714524e.png)
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
となり、playerView(YTPlayerView!)がnilでfatal error: unexpectedly found nil while unwrapping an Optional value
|
72
|
+
|
73
|
+
(lldb) となっていました。
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
どうすれば正しく取得できるのでしょうか?
|
10
訂正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
他のViewから動画プレイヤー(YTPlayer)の取得を行いたい。
|
test
CHANGED
@@ -18,181 +18,13 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
前回の質問の回答でdelgateを用いての回答を頂いたのですがそれではMasterではViewConとSelectVCTしか取得できずSongVCTまでたどり着けませんでした。
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
以下前回、回答いただいてchildviewを取得しているMasterのコードです。
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
```Swift3
|
30
|
-
|
31
|
-
import UIKit
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
class MasterVCT: UIViewController,SongTVCDelegate{
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
var upper: ViewController!
|
40
|
-
|
41
|
-
var lower: SongTVC!
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
override func viewDidLoad() {
|
46
|
-
|
47
|
-
super.viewDidLoad()
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
print("check",self.childViewControllers)
|
52
|
-
|
53
|
-
//UINavigationController: 0x7fc50c803800, MyApp.ViewController: 0x7fc50bc12af0
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
upper = self.childViewControllers[1] as! ViewController
|
58
|
-
|
59
|
-
let nav = self.childViewControllers[0] as! UINavigationController
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
let addEventViewController = nav.topViewController as! SelectTVC!
|
64
|
-
|
65
|
-
//ここでSongVCTを取得したかった。
|
66
|
-
|
67
|
-
//3つ目の遷移先の取得がわからなかった。
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
addEventViewController?.delegate = self
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
print("check2",nav.childViewControllers)
|
76
|
-
|
77
|
-
//<MyApp.SelectTVC: 0x7f9f08607b30>
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
func play() {
|
86
|
-
|
87
|
-
upper.playerView?.playVideo()
|
88
|
-
|
89
|
-
print("")
|
90
|
-
|
91
|
-
}
|
92
|
-
|
93
|
-
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
```
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
ViewConのコード
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
```Swift3
|
106
|
-
|
107
|
-
import UIKit
|
108
|
-
|
109
|
-
import youtube_ios_player_helper
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
class ViewController: UIViewController, YTPlayerViewDelegate{
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
@IBOutlet weak var playerView: YTPlayerView?
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
var appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
override func viewDidLoad() {
|
126
|
-
|
127
|
-
super.viewDidLoad()
|
128
|
-
|
129
|
-
// Do any additional setup after loading the view, typically from a nib.
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
self.playerView?.delegate = self
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
self.playerView?.sizeToFit()
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
let vars = ["playsinline": 1, "controls": 2, "showinfo": 0, "origin":"https://www.google.com"] as [String : Any]
|
142
|
-
|
143
|
-
playerView?.load(withVideoId: self.appDelegate.selectMV, playerVars: vars)
|
144
|
-
|
145
|
-
print(self.appDelegate.selectMV)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
func playerViewDidBecomeReady(_ playerView: YTPlayerView) {
|
154
|
-
|
155
|
-
//playerView.stopVideo()
|
156
|
-
|
157
|
-
playerView.playVideo()
|
158
|
-
|
159
|
-
}
|
160
|
-
|
161
|
-
func play() {
|
162
|
-
|
163
|
-
print("Push! play")
|
164
|
-
|
165
|
-
playerView!.playVideo()
|
166
|
-
|
167
|
-
}
|
168
|
-
|
169
|
-
}
|
170
21
|
|
171
22
|
|
172
23
|
|
173
24
|
|
25
|
+
以下どうにか再生しようとして試した方法です。
|
174
26
|
|
175
|
-
```
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
画像では動画選んで読み込んでるように見えますがViewConのviewdidloadを読んだ時点で動画を再生しているため。選んだものとは異なる動画が再生されてます。
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
ーーーーーーーーーーーーー追記ーーーーーーーーーーーーーー
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
27
|
+
SongVCTからViewConのviewdidloadを読んでみましたがplayerView(YTplayer)がnilで動画を読みこまないようでした。
|
196
28
|
|
197
29
|
どうすればplayerView(YTplayer)を取得できますでしょうか?
|
198
30
|
|
@@ -308,7 +140,7 @@
|
|
308
140
|
|
309
141
|
//playerView nil
|
310
142
|
|
311
|
-
playerView
|
143
|
+
playerView!.load(withVideoId: self.appDelegate.selectMV, playerVars: vars)
|
312
144
|
|
313
145
|
}
|
314
146
|
|
9
タイトル修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
別Viewから
|
1
|
+
別Viewから動画プレイヤーの取得(YTPlayer_youtube api)について 追記
|
test
CHANGED
File without changes
|
8
エラー詳細追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -192,9 +192,19 @@
|
|
192
192
|
|
193
193
|
|
194
194
|
|
195
|
-
以下の方法でSongVCTからViewConを読んでみましたがy
|
195
|
+
以下の方法でSongVCTからViewConを読んでみましたがplayerView(YTplayer)がnilで動画を読みこまないようでした。
|
196
|
-
|
196
|
+
|
197
|
-
どうすればy
|
197
|
+
どうすればplayerView(YTplayer)を取得できますでしょうか?
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
![playerView nil](bcff8c83554a4d427d2bfec40bc9c479.png)
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
198
208
|
|
199
209
|
|
200
210
|
|
7
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -184,7 +184,11 @@
|
|
184
184
|
|
185
185
|
|
186
186
|
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
187
|
-
|
191
|
+
ーーーーーーーーーーーーー追記ーーーーーーーーーーーーーー
|
188
192
|
|
189
193
|
|
190
194
|
|
6
修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
別Viewから
|
1
|
+
別Viewからytplayerの取得について 追記部分を参照下さい
|
test
CHANGED
@@ -177,3 +177,139 @@
|
|
177
177
|
|
178
178
|
|
179
179
|
画像では動画選んで読み込んでるように見えますがViewConのviewdidloadを読んだ時点で動画を再生しているため。選んだものとは異なる動画が再生されてます。
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
**追記**
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
以下の方法でSongVCTからViewConを読んでみましたがytplayerがnilで動画を読みこまないようでした。
|
192
|
+
|
193
|
+
どうすればytplayerを取得できますでしょうか?
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
以下SongVCTのセルタップ動作
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
```Swift3
|
202
|
+
|
203
|
+
// Cell が選択された場合
|
204
|
+
|
205
|
+
override func tableView(_ table: UITableView,didSelectRowAt indexPath: IndexPath) {
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
self.appDelegate.selectMV = self.appDelegate.videoIDAR[indexPath.row]
|
212
|
+
|
213
|
+
print("",self.appDelegate.selectMV)
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
let parent = storyboard!.instantiateViewController(withIdentifier: "player");
|
218
|
+
|
219
|
+
parent.viewDidLoad()
|
220
|
+
|
221
|
+
//ViewConのviewdidload再読込
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
```
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
ViewConのコード
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
```Swift3
|
238
|
+
|
239
|
+
import UIKit
|
240
|
+
|
241
|
+
import youtube_ios_player_helper
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
class ViewController: UIViewController, YTPlayerViewDelegate{
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
@IBOutlet weak var playerView: YTPlayerView?
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
var appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
override func viewDidLoad() {
|
258
|
+
|
259
|
+
super.viewDidLoad()
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
///self.playerView?.delegate = self
|
264
|
+
|
265
|
+
playerView?.delegate = self
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
//self.playerView?.sizeToFit()
|
270
|
+
|
271
|
+
playerView?.sizeToFit()
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
let vars = ["playsinline": 1, "controls": 2, "showinfo": 0, "origin":"https://www.google.com"] as [String : Any]
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
if self.appDelegate.selectMV == ""
|
280
|
+
|
281
|
+
{
|
282
|
+
|
283
|
+
print("Not good",self.appDelegate.selectMV)
|
284
|
+
|
285
|
+
}
|
286
|
+
|
287
|
+
else
|
288
|
+
|
289
|
+
{
|
290
|
+
|
291
|
+
print("Ok good",self.appDelegate.selectMV)
|
292
|
+
|
293
|
+
//playerView!でfatal error: unexpectedly found nil while unwrapping an Optional value
|
294
|
+
|
295
|
+
//playerView nil
|
296
|
+
|
297
|
+
playerView?.load(withVideoId: self.appDelegate.selectMV, playerVars: vars)
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
func playerViewDidBecomeReady(_ playerView: YTPlayerView) {
|
308
|
+
|
309
|
+
playerView.playVideo()
|
310
|
+
|
311
|
+
}
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
```
|
5
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -158,7 +158,13 @@
|
|
158
158
|
|
159
159
|
}
|
160
160
|
|
161
|
-
|
161
|
+
func play() {
|
162
|
+
|
163
|
+
print("Push! play")
|
164
|
+
|
165
|
+
playerView!.playVideo()
|
166
|
+
|
167
|
+
}
|
162
168
|
|
163
169
|
}
|
164
170
|
|
4
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
-
以下前回、回答いただいてchildviewを取得しているコードです。
|
25
|
+
以下前回、回答いただいてchildviewを取得しているMasterのコードです。
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -94,6 +94,76 @@
|
|
94
94
|
|
95
95
|
|
96
96
|
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
ViewConのコード
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
```Swift3
|
106
|
+
|
107
|
+
import UIKit
|
108
|
+
|
109
|
+
import youtube_ios_player_helper
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
class ViewController: UIViewController, YTPlayerViewDelegate{
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
@IBOutlet weak var playerView: YTPlayerView?
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
var appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
override func viewDidLoad() {
|
126
|
+
|
127
|
+
super.viewDidLoad()
|
128
|
+
|
129
|
+
// Do any additional setup after loading the view, typically from a nib.
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
self.playerView?.delegate = self
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
self.playerView?.sizeToFit()
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
let vars = ["playsinline": 1, "controls": 2, "showinfo": 0, "origin":"https://www.google.com"] as [String : Any]
|
142
|
+
|
143
|
+
playerView?.load(withVideoId: self.appDelegate.selectMV, playerVars: vars)
|
144
|
+
|
145
|
+
print(self.appDelegate.selectMV)
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
func playerViewDidBecomeReady(_ playerView: YTPlayerView) {
|
154
|
+
|
155
|
+
//playerView.stopVideo()
|
156
|
+
|
157
|
+
playerView.playVideo()
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
97
167
|
|
98
168
|
|
99
169
|
```
|
3
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,6 +64,8 @@
|
|
64
64
|
|
65
65
|
//ここでSongVCTを取得したかった。
|
66
66
|
|
67
|
+
//3つ目の遷移先の取得がわからなかった。
|
68
|
+
|
67
69
|
|
68
70
|
|
69
71
|
addEventViewController?.delegate = self
|
@@ -92,6 +94,10 @@
|
|
92
94
|
|
93
95
|
|
94
96
|
|
95
|
-
|
97
|
+
|
96
98
|
|
97
99
|
```
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
画像では動画選んで読み込んでるように見えますがViewConのviewdidloadを読んだ時点で動画を再生しているため。選んだものとは異なる動画が再生されてます。
|
2
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
class MasterVCT: UIViewController,S
|
35
|
+
class MasterVCT: UIViewController,SongTVCDelegate{
|
36
36
|
|
37
37
|
|
38
38
|
|
1
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -29,14 +29,6 @@
|
|
29
29
|
```Swift3
|
30
30
|
|
31
31
|
import UIKit
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
protocol MasterVCTDelegate: class {
|
36
|
-
|
37
|
-
func play()
|
38
|
-
|
39
|
-
}
|
40
32
|
|
41
33
|
|
42
34
|
|