-
-
Notifications
You must be signed in to change notification settings - Fork 319
Expand file tree
/
Copy pathCode.php
More file actions
36 lines (29 loc) · 926 Bytes
/
Code.php
File metadata and controls
36 lines (29 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types = 1);
namespace Embed\Adapters\Tidal\Detectors;
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
class Code extends Detector
{
public function detect(): ?EmbedCode
{
return parent::detect()
?: $this->fallback();
}
private function fallback(): ?EmbedCode
{
$uri = $this->extractor->getUri();
if (!preg_match('{^/playlist/(?P<uuid>[0-9a-fA-F\-]{36})$}', $uri->getPath(), $matches)) {
return NULL;
}
$html = html('iframe', [
'src' => 'https://embed.tidal.com/playlists/' . $matches['uuid'] . '?disableAnalytics=true',
'allow' => 'encrypted-media',
'allowfullscreen' => 'allowfullscreen',
'frameborder' => '0',
'style' => 'width:100%;height:352px',
]);
return new EmbedCode($html, null, 352);
}
}