Parcourir la source

don't do metadata=preload, something is funky

George S. Baugh il y a 5 ans
Parent
commit
d617d8244c
2 fichiers modifiés avec 6 ajouts et 3 suppressions
  1. 3 0
      www/server.psgi
  2. 3 3
      www/templates/posts.tx

+ 3 - 0
www/server.psgi

@@ -151,12 +151,15 @@ sub _serve ($path, $streaming=0, $last_fetch=0) {
 
     #TODO Return 304 unchanged for files that haven't changed since the requestor reports they last fetched
     my $mt = (stat($path))[9];
+    #my $sz = (stat(_))[7];
     my @gm = gmtime($mt);
     my $now_string = strftime( "%a, %d %b %Y %H:%M:%S GMT", @gm );
     my $code = $mt > $last_fetch ? 200 : 304;
     #XXX something broken about the above logic
     $code=200;
 
+    #XXX doing metadata=preload on videos doesn't work right?
+    #push(@headers, "Content-Length: $sz\n");
     push(@headers, "Last-Modified: $now_string\n");
 
     my $h = join("\n",@headers);

+ 3 - 3
www/templates/posts.tx

@@ -22,7 +22,7 @@
         <a href="<: $route :>/<: $post.id :>" class="tile">
         : }
         : if ($post.is_video) {
-            <video preload="metadata" class="responsive" controls poster="<: $post.preview :>" >
+            <video preload="none" class="responsive" controls poster="<: $post.preview :>" >
                 <source src="<: $post.href :>" type="<: $post.content_type :>" />
                 Your browser does not support the video tag.
             </video>
@@ -58,7 +58,7 @@
                 <div style="background-image:url(<: $post.preview :>);" class="responsive preview"></div>
             : }
             : if ( $post.video_href ) {
-                <video class="responsive" controls poster="<: $post.preview :>" >
+                <video preload="none" class="responsive" controls poster="<: $post.preview :>" >
                     <source src="<: $post.video_href :>" type="<: $post.video_content_type :>" />
                     Your browser does not support the video tag.
                 </video>
@@ -70,7 +70,7 @@
                 </audio>
             : }
             : if ( $post.is_video ) {
-                <video class="responsive" controls poster="<: $post.preview :>" >
+                <video preload="none" class="responsive" controls poster="<: $post.preview :>" >
                     <source src="<: $post.href :>" type="<: $post.content_type :>" />
                     Your browser does not support the video tag.
                 </video>