فهرست منبع

Implement alternative-to in ppvm player, minor touch ups

Billy Barrow 2 سال پیش
والد
کامیت
1cd5c6875d
5فایلهای تغییر یافته به همراه23 افزوده شده و 7 حذف شده
  1. 1 1
      index.php
  2. 6 1
      ppvm_player.js
  3. 9 2
      themes/baseline/baseline.css
  4. 6 2
      themes/baseline/navigation.php
  5. 1 1
      video_player.php

+ 1 - 1
index.php

@@ -47,7 +47,7 @@ function get_ppub_file_list() {
         $list = array();
         while($file = readdir($dir)){
             if ($file != '.' and $file != '..' and $file != "lib.ppix"){
-                $ctime = filectime(PUBLICATION_DIR . "/" . $file) . ',' . $file;
+                $ctime = filemtime(PUBLICATION_DIR . "/" . $file) . ',' . $file;
                 $list[$ctime] = $file;
             }
         }

+ 6 - 1
ppvm_player.js

@@ -53,7 +53,12 @@ function qualitySelected() {
 
 function filterOptions(options) {
     player = document.getElementById("player");
-    return options.filter(o => o.type === "video" && player.canPlayType(`${o.mimetype}; codecs="${o.metadata.codecs}"`));
+    return options.filter(o => o.type === "video" && canPlayStream(o) && (o.metadata.alternative_to == undefined || !canPlayStream(options.find(s => s.label == o.metadata.alternative_to))));
+}
+
+function canPlayStream(stream) {
+    player = document.getElementById("player");
+    return player.canPlayType(`${stream.mimetype}; codecs="${stream.metadata.codecs}"`);
 }
 
 function findOptimalOptionForScreen(options) {

+ 9 - 2
themes/baseline/baseline.css

@@ -108,7 +108,7 @@ code, pre {
 }
 code pre , pre code { padding: 0; }
 
-h1+h2,
+h1:not(header h1)+h2,
 h3+h4{
     margin-top: -1.2em;
     margin-bottom: 1.2em;
@@ -292,10 +292,17 @@ section.subtle {
     border-color: transparent;
 }
 
-.tight {
+.tight,
+.tight-group > *:not(:first-child):not(:last-child) {
     margin-bottom: 0px;
     margin-top: 0px;
 }
+.tight-group > *:first-child {
+    margin-bottom: 0px;
+}
+.tight-group > *:last-child {
+    margin-top: 0px;
+}
 
 span.icon {
     text-decoration: none !important;

+ 6 - 2
themes/baseline/navigation.php

@@ -3,8 +3,8 @@
 function baseline_navigation() {
     ?>
     <ul class="compressed">
-        <li><a href="<?php echo(SITE_URL);?>/"><span class="icon">📰</span>Latest</a></li>
-        <li><a href="<?php echo(SITE_URL);?>/feed.rss"><span class="icon">🛜</span>RSS Feed</a></li>
+        <li><a href="<?php echo(SITE_URL);?>/"><span class="icon">🗞️</span>Latest</a></li>
+        <li><a href="<?php echo(SITE_URL);?>/feed.rss"><span class="icon">📡</span>RSS Feed</a></li>
     </ul>
     <?php
 }
@@ -14,6 +14,8 @@ function baseline_banner_css() {
         header[role="banner"] {
             background:
                 url("<?php echo(SITE_BANNER); ?>");
+            background-position: center;
+            background-size: cover;
         }
         @media (prefers-color-scheme: dark) {
             header[role="banner"] {
@@ -23,6 +25,8 @@ function baseline_banner_css() {
                         rgba(43, 54, 65, 0.6)
                     ),
                     url("<?php echo(SITE_BANNER); ?>");
+                background-position: center;
+                background-size: cover;
             }
         }
         <?php 

+ 1 - 1
video_player.php

@@ -331,7 +331,7 @@ function ppvm_player($ppub, $path, $video) {
                     $size = ($entry_asset->end_location - $entry_asset->start_location);
                     echo("            { type: \"" . $entry->type . "\",  mimetype: \"" . $entry_asset->mimetype . "\", path: \"" . $entry->filename . "\", label: \"" . $entry->label . "\", byterate: " . $size / (float)$video->metadata["duration"] . ", filesize: " . $size . ", metadata: { ");
                     foreach ($entry->metadata as $key => $val) {
-                        echo($key . ": \"" . $val . "\", ");
+                        echo(str_replace("-", "_", $key) . ": \"" . $val . "\", ");
                     }
                     echo("}},\n");
                 }