Skip to content

Commit cba8240

Browse files
committed
formats d'enregistrements multiples
1 parent 9ae8bea commit cba8240

4 files changed

Lines changed: 199 additions & 2 deletions

File tree

src/Core/Image.php

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?php
2+
/**
3+
* BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
4+
*
5+
* Copyright (c) 2016-2018 BigBlueButton Inc. and by respective authors (see below).
6+
*
7+
* This program is free software; you can redistribute it and/or modify it under the
8+
* terms of the GNU Lesser General Public License as published by the Free Software
9+
* Foundation; either version 3.0 of the License, or (at your option) any later
10+
* version.
11+
*
12+
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14+
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License along
17+
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
namespace BigBlueButton\Core;
21+
22+
/**
23+
* Class Record
24+
* @package BigBlueButton\Core
25+
*/
26+
class Image
27+
{
28+
/**
29+
* @var string
30+
*/
31+
private $alt;
32+
33+
/**
34+
* @var int
35+
*/
36+
private $height;
37+
38+
/**
39+
* @var int
40+
*/
41+
private $width;
42+
43+
/**
44+
* @var string
45+
*/
46+
private $link;
47+
48+
/**
49+
* @return string
50+
*/
51+
public function getAlt(): string
52+
{
53+
return $this->alt;
54+
}
55+
56+
/**
57+
* @param string $alt
58+
*/
59+
public function setAlt(string $alt): void
60+
{
61+
$this->alt = $alt;
62+
}
63+
64+
/**
65+
* @return int
66+
*/
67+
public function getHeight(): int
68+
{
69+
return $this->height;
70+
}
71+
72+
/**
73+
* @param int $height
74+
*/
75+
public function setHeight(int $height): void
76+
{
77+
$this->height = $height;
78+
}
79+
80+
/**
81+
* @return int
82+
*/
83+
public function getWidth(): int
84+
{
85+
return $this->width;
86+
}
87+
88+
/**
89+
* @param int $width
90+
*/
91+
public function setWidth(int $width): void
92+
{
93+
$this->width = $width;
94+
}
95+
96+
/**
97+
* @return string
98+
*/
99+
public function getLink(): string
100+
{
101+
return $this->link;
102+
}
103+
104+
/**
105+
* @param string $link
106+
*/
107+
public function setLink(string $link): void
108+
{
109+
$this->link = $link;
110+
}
111+
}

src/Core/Record.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* You should have received a copy of the GNU Lesser General Public License along
1717
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
1818
*/
19+
1920
namespace BigBlueButton\Core;
2021

2122
/**
@@ -35,6 +36,7 @@ class Record
3536
private $playbackUrl;
3637
private $playbackLength;
3738
private $metas;
39+
private $playbacks;
3840

3941
/**
4042
* Record constructor.
@@ -56,6 +58,43 @@ public function __construct($xml)
5658
foreach ($xml->metadata->children() as $meta) {
5759
$this->metas[$meta->getName()] = $meta->__toString();
5860
}
61+
62+
foreach ($xml->playback->children() as $format) {
63+
$aFormat = [];
64+
foreach ($format->children() as $formAttribut) {
65+
// if ($formAttribut != "preview"){ }
66+
$aFormat[$formAttribut->getName()] = $formAttribut->__toString();
67+
}
68+
if (isset($format->preview)) {
69+
$images = [];
70+
foreach ($format->preview->images->children() as $image) {
71+
$imageObj = new Image();
72+
$imageObj->setAlt( $image['alt']->__toString());
73+
$imageObj->setHeight((int) $image['height']->__toString());
74+
$imageObj->setWidth((int) $image['width']->__toString());
75+
$imageObj->setLink($image->__toString());
76+
$images[] = $imageObj;
77+
}
78+
$aFormat['preview'] = $images;
79+
}
80+
$this->playbacks[] = $aFormat;
81+
}
82+
}
83+
84+
/**
85+
* @return array
86+
*/
87+
public function getPlaybacks(): array
88+
{
89+
return $this->playbacks;
90+
}
91+
92+
/**
93+
* @param array $playbacks
94+
*/
95+
public function setPlaybacks(array $playbacks): void
96+
{
97+
$this->playbacks = $playbacks;
5998
}
6099

61100
/**

tests/Responses/GetRecordingsResponseTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,38 @@ public function testRecordMetadataContent()
6565
$this->assertEquals('moodle-mod_bigbluebuttonbn (2015080611)', $metas['bbb-origin-tag']);
6666
}
6767

68+
public function testRecordingsPlayback()
69+
{
70+
$this->assertEquals('SUCCESS', $this->records->getReturnCode());
71+
72+
$this->assertCount(6, $this->records->getRecords());
73+
$aRecord = $this->records->getRecords()[0];
74+
$formatN1 = $aRecord->getPlaybacks()[0]; // without images preview
75+
$this->assertEquals('podcast', $formatN1['type']);
76+
$this->assertEquals('https://testurl/podcast/1.ogg', $formatN1['url']);
77+
$this->assertEquals('111', $formatN1['processingTime']);
78+
$this->assertEquals('222', $formatN1['length']);
79+
$this->assertEquals('333', $formatN1['size']);
80+
81+
$formatN2 = $aRecord->getPlaybacks()[1]; // having images preview
82+
$this->assertEquals('presentation', $formatN2['type']);
83+
$this->assertEquals('https://testurl/podcast/2.ogg', $formatN2['url']);
84+
$this->assertEquals('444', $formatN2['processingTime']);
85+
$this->assertEquals('555', $formatN2['length']);
86+
$this->assertEquals('666', $formatN2['size']);
87+
88+
$images = $formatN2['preview'];
89+
$this->assertEquals('testurl1', $images[0]->getAlt());
90+
$this->assertEquals('136', $images[0]->getHeight());
91+
$this->assertEquals('176', $images[0]->getWidth());
92+
$this->assertEquals('https://testurl1.png', $images[0]->getLink());
93+
94+
$this->assertEquals('testurl2', $images[1]->getAlt());
95+
$this->assertEquals('136', $images[1]->getHeight());
96+
$this->assertEquals('176', $images[1]->getWidth());
97+
$this->assertEquals('https://testurl2.png', $images[1]->getLink());
98+
}
99+
68100
public function testGetRecordingResponseTypes()
69101
{
70102
$this->assertEachGetterValueIsString($this->records, ['getReturnCode']);

tests/fixtures/get_recordings.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,25 @@
2121
<bbb-recording-tags><![CDATA[]]></bbb-recording-tags>
2222
</metadata>
2323
<playback>
24+
<format>
25+
<type>podcast</type>
26+
<url>https://testurl/podcast/1.ogg</url>
27+
<processingTime>111</processingTime>
28+
<length>222</length>
29+
<size>333</size>
30+
</format>
2431
<format>
2532
<type>presentation</type>
26-
<url>http://test-install.blindsidenetworks.com/playback/presentation/0.9.0/playback.html?meetingId=f71d810b6e90a4a34ae02b8c7143e8733178578e-1462807897120</url>
27-
<length>44</length>
33+
<url>https://testurl/podcast/2.ogg</url>
34+
<processingTime>444</processingTime>
35+
<length>555</length>
36+
<size>666</size>
37+
<preview>
38+
<images>
39+
<image alt="testurl1" height="136" width="176">https://testurl1.png</image>
40+
<image alt="testurl2" height="136" width="176">https://testurl2.png</image>
41+
</images>
42+
</preview>
2843
</format>
2944
</playback>
3045
</recording>

0 commit comments

Comments
 (0)