Skip to content

Commit 66c8784

Browse files
committed
Fixes / adds text track support.
1 parent 9b5b95e commit 66c8784

File tree

4 files changed

+237
-6
lines changed

4 files changed

+237
-6
lines changed

lib/Brightcove/API/Request/IngestRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function applyJSON(array $json) {
6161
$this->applyProperty($json, 'poster');
6262
$this->applyProperty($json, 'thumbnail');
6363
$this->applyProperty($json, 'capture_images');
64-
$this->applyProperty($json, 'text_tracks');
64+
$this->applyProperty($json, 'text_tracks', NULL, IngestTextTrack::class, TRUE);
6565
}
6666

6767
/**
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
<?php
2+
3+
namespace Brightcove\Object\Video;
4+
5+
use Brightcove\Object\ObjectBase;
6+
7+
class TextTrack extends ObjectBase {
8+
9+
/**
10+
* @var string
11+
*/
12+
protected $id;
13+
14+
/**
15+
* @var string
16+
*/
17+
protected $src;
18+
19+
/**
20+
* @var string
21+
*/
22+
protected $srclang;
23+
24+
/**
25+
* @var string
26+
*/
27+
protected $kind;
28+
29+
/**
30+
* @var string
31+
*/
32+
protected $mime_type;
33+
34+
/**
35+
* @var string
36+
*/
37+
protected $asset_id;
38+
39+
/**
40+
* @var TextTrackSource[]
41+
*/
42+
protected $sources;
43+
44+
/**
45+
* @var boolean
46+
*/
47+
protected $default;
48+
49+
public function applyJSON(array $json) {
50+
parent::applyJSON($json);
51+
$this->applyProperty($json, 'id');
52+
$this->applyProperty($json, 'src');
53+
$this->applyProperty($json, 'srclang');
54+
$this->applyProperty($json, 'kind');
55+
$this->applyProperty($json, 'mime_type');
56+
$this->applyProperty($json, 'asset_id');
57+
$this->applyProperty($json, 'sources', NULL, TextTrackSource::class, TRUE);
58+
$this->applyProperty($json, 'default');
59+
}
60+
61+
/**
62+
* @return string
63+
*/
64+
public function getId() {
65+
return $this->id;
66+
}
67+
68+
/**
69+
* @param string $id
70+
* @return TextTrack
71+
*/
72+
public function setId($id) {
73+
$this->id = $id;
74+
$this->fieldChanged('id');
75+
return $this;
76+
}
77+
78+
/**
79+
* @return string
80+
*/
81+
public function getSrc() {
82+
return $this->src;
83+
}
84+
85+
/**
86+
* @param string $src
87+
* @return TextTrack
88+
*/
89+
public function setSrc($src) {
90+
$this->src = $src;
91+
$this->fieldChanged('src');
92+
return $this;
93+
}
94+
95+
/**
96+
* @return string
97+
*/
98+
public function getSrclang() {
99+
return $this->srclang;
100+
}
101+
102+
/**
103+
* @param string $srclang
104+
* @return TextTrack
105+
*/
106+
public function setSrclang($srclang) {
107+
$this->srclang = $srclang;
108+
$this->fieldChanged('srclang');
109+
return $this;
110+
}
111+
112+
/**
113+
* @return string
114+
*/
115+
public function getKind() {
116+
return $this->kind;
117+
}
118+
119+
/**
120+
* @param string $kind
121+
* @return TextTrack
122+
*/
123+
public function setKind($kind) {
124+
$this->kind = $kind;
125+
$this->fieldChanged('kind');
126+
return $this;
127+
}
128+
129+
/**
130+
* @return string
131+
*/
132+
public function getMimeType() {
133+
return $this->mime_type;
134+
}
135+
136+
/**
137+
* @param string $mime_type
138+
* @return TextTrack
139+
*/
140+
public function setMimeType($mime_type) {
141+
$this->mime_type = $mime_type;
142+
$this->fieldChanged('mime_type');
143+
return $this;
144+
}
145+
146+
/**
147+
* @return string
148+
*/
149+
public function getAssetId() {
150+
return $this->asset_id;
151+
}
152+
153+
/**
154+
* @param string $asset_id
155+
* @return TextTrack
156+
*/
157+
public function setAssetId($asset_id) {
158+
$this->asset_id = $asset_id;
159+
$this->fieldChanged('asset_id');
160+
return $this;
161+
}
162+
163+
/**
164+
* @return TextTrackSource[]
165+
*/
166+
public function getSources() {
167+
return $this->sources;
168+
}
169+
170+
/**
171+
* @param TextTrackSource[] $sources
172+
* @return TextTrack
173+
*/
174+
public function setSources(array $sources) {
175+
$this->sources = $sources;
176+
$this->fieldChanged('sources');
177+
return $this;
178+
}
179+
180+
/**
181+
* @return boolean
182+
*/
183+
public function isDefault() {
184+
return $this->default;
185+
}
186+
187+
/**
188+
* @param boolean $default
189+
* @return TextTrack
190+
*/
191+
public function setDefault($default) {
192+
$this->default = $default;
193+
$this->fieldChanged('default');
194+
return $this;
195+
}
196+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Brightcove\Object\Video;
4+
5+
use Brightcove\Object\ObjectBase;
6+
7+
class TextTrackSource extends ObjectBase {
8+
9+
/**
10+
* @var string
11+
*/
12+
protected $src;
13+
14+
public function applyJSON(array $json) {
15+
parent::applyJSON($json);
16+
$this->applyProperty($json, 'src');
17+
}
18+
19+
/**
20+
* @return string
21+
*/
22+
public function getSrc() {
23+
return $this->src;
24+
}
25+
26+
/**
27+
* @param string $src
28+
* @return TextTrackSource
29+
*/
30+
public function setSrc($src) {
31+
$this->src = $src;
32+
$this->fieldChanged('src');
33+
return $this;
34+
}
35+
}

lib/Brightcove/Object/Video/Video.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class Video extends ObjectBase {
138138
/**
139139
* Array of text_track objects.
140140
*
141-
* @var array.
141+
* @var TextTrack[]
142142
*/
143143
protected $text_tracks;
144144
/**
@@ -172,7 +172,7 @@ public function applyJSON(array $json) {
172172
$this->applyProperty($json, 'sharing', NULL, Sharing::class);
173173
$this->applyProperty($json, 'state');
174174
$this->applyProperty($json, 'tags');
175-
$this->applyProperty($json, 'text_tracks');
175+
$this->applyProperty($json, 'text_tracks', NULL, TextTrack::class, TRUE);
176176
$this->applyProperty($json, 'updated_at');
177177
}
178178

@@ -517,17 +517,17 @@ public function setTags(array $tags) {
517517
}
518518

519519
/**
520-
* @return string
520+
* @return TextTrack[]
521521
*/
522522
public function getTextTracks() {
523523
return $this->text_tracks;
524524
}
525525

526526
/**
527-
* @param string $text_tracks
527+
* @param TextTrack[] $text_tracks
528528
* @return $this
529529
*/
530-
public function setTextTracks($text_tracks) {
530+
public function setTextTracks(array $text_tracks) {
531531
$this->text_tracks = $text_tracks;
532532
$this->fieldChanged('text_tracks');
533533
return $this;

0 commit comments

Comments
 (0)