Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-54001

On Chrome v.50 for Android the video not load, pluginfile.php header problem

    Details

    • Affected Branches:
      MOODLE_30_STABLE

      Description

      Hi all,

      I have a scorm package that load mp4 video, but the problem appear if I put a video as activity too.

      In desktop browser there no problem, but in Android with chrome v.50 (with v.40 work's) the video won't display,

      We have try with moodle 2.8.5 (Build: 20150310) and 3.0.3+ (Build: 20160429), same problem.

      The same video included into html page with the tag video show corretcly with the source that point to a php file where this is the header it show

      Accept-Ranges:bytes
      Connection:close
      Content-Disposition:inline;
      Content-Length:248711
      Content-Range:bytes 0-248711/248711
      Content-Transfer-Encoding:binary
      Content-Type:video/mp4
      Date:Sun, 01 May 2016 09:23:50 GMT
      Server:Apache/2.4.9 (Win64) PHP/5.5.12
      X-Powered-By:PHP/5.5.12
      

      If I put the same response header that point direct to a mp4 file into pluginfile.php it show. Easy

      <?php
      $path = 'movie.mp4';
      $size=filesize($path);
      $fm=@fopen($path,'rb');
      if(!$fm) {
        // You can also redirect here
        header ("HTTP/1.0 404 Not Found");
        die();
      }
      $begin=0;
      $end=$size;
      if(isset($_SERVER['HTTP_RANGE'])) {
        if(preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) {
          $begin=intval($matches[0]);
          if(!empty($matches[1])) {
            $end=intval($matches[1]);
          }
        }
      }
      if($begin>0||$end<$size)
        header('HTTP/1.0 206 Partial Content');
      else
        header('HTTP/1.0 200 OK');
      /*
      header("Content-Type: video/mp4");
      header('Accept-Ranges: bytes');
      header('Content-Length:'.($end-$begin));
      header("Content-Disposition: inline;");
      header("Content-Range: bytes $begin-$end/$size");
      header("Content-Transfer-Encoding: binary\n");
      header('Connection: close');
      */
      header("Accept-Ranges:bytes");
      header("Cache-Control:private, max-age=21600, no-transform");
      ;header("Connection:Keep-Alive");
      ;header("Content-Length:".($end-$begin));
      header("Content-Range:bytes". $begin-$end/$size);
      header("Content-Type:video/mp4");
      ;header("Date:Sun, 01 May 2016 09:59:48 GMT");
      ;header("Expires:Sun, 01 May 2016 15:59:48 GMT");
      ;header("Keep-Alive:timeout=5, max=98");
      ;header("Last-Modified:Sun, 01 May 2016 09:31:29 GMT");
      $cur=$begin;
      fseek($fm,$begin,0);
      while(!feof($fm)&&$cur<$end&&(connection_status()==0))
      { print fread($fm,min(1024*16,$end-$cur));
        $cur+=1024*16;
        usleep(1000);
      }
      die();
      

      Whell I think the problem is the response of pluginfile.php but I realy don't know why is doing that.
      My local machine win 10 - WampServer 2.5 - Php 5.5.12

      Any suggestions?

      Thanks.
      Giacomo.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                giacomo.battel Giacomo
                Participants:
                Component watchers:
                Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Jake Dallimore, Jun Pataleta
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: