git.cweiske.de
/
playVideoOnDreamboxProxy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e49228d
)
Filter out VP9 streams, sort by quality
author
Christian Weiske
<cweiske@cweiske.de>
Fri, 3 Sep 2021 20:14:10 +0000
(22:14 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Fri, 3 Sep 2021 20:14:10 +0000
(22:14 +0200)
www/functions.php
patch
|
blob
|
history
diff --git
a/www/functions.php
b/www/functions.php
index 6ad1044e27273a404c0ed571536eb184be80a219..617724a6fe382e71505d70bef33f604246e1023a 100644
(file)
--- a/
www/functions.php
+++ b/
www/functions.php
@@
-89,17
+89,36
@@
function extractVideoUrlFromJson($json)
errorOut('Cannot decode JSON: ' . json_last_error_msg());
}
errorOut('Cannot decode JSON: ' . json_last_error_msg());
}
- $
url = null
;
+ $
safeFormats = []
;
foreach ($data->formats as $format) {
if (strpos($format->format, 'hls') !== false) {
//dreambox 7080hd does not play hls files
continue;
}
foreach ($data->formats as $format) {
if (strpos($format->format, 'hls') !== false) {
//dreambox 7080hd does not play hls files
continue;
}
+ if (strpos($format->format, 'vp9') !== false) {
+ //dreambox 7080hd does not play VP9 video streams
+ continue;
+ }
if ($format->protocol == 'http_dash_segments') {
//split up into multiple small files
continue;
}
if ($format->protocol == 'http_dash_segments') {
//split up into multiple small files
continue;
}
+ if ($format->ext == 'flv') {
+ //Internal data flow error
+ continue;
+ }
+ $safeFormats[] = $format;
+ }
+
+ $url = null;
+
+ //filter: best quality
+ usort($safeFormats, function ($a, $b) {
+ return ($b->quality ?? 0) - ($a->quality ?? 0);
+ });
+ foreach ($safeFormats as $format) {
$url = $format->url;
$url = $format->url;
+ break;
}
if ($url === null) {
}
if ($url === null) {