Hi,

we've been doing some research on how to deliver video to iphones, ipods, ipads and got the following

The iPhone supports the following codecs:

File container: MPEG-4
Video codec: H.264, baseline profile
Audio codec: AAC
In addition to making sure you use a supported codec, you will want to deliver the videos at an encoding rate that can be expected to play back reasonably well on a mobile device. You need to find a balance that will not take too long to buffer while still delivering a high quality viewing experience. Brightcove recommends the following data rates for your video and audio channel in your file:

Total data rate: 256kbps
Video data rate: 192kbps
Audio data rate: 64kbps

Can Bluedrop incorporate this? We're happy to pay for development if you provide a quote

Thanks,
Ken

Comments

jbrown’s picture

You can enter these settings directly into the field configuration.

Let me know the results.

kenwen’s picture

just tried it - unfortunately Flash isn't compatible with iphones/ipods.

grr

any suggestions?

thanks,
Ken

ferrangil’s picture

It's not exactly that issue, but it is possible to transcode the video to two (2) different resolutions/bitrates? Youtube are doing more than 2 now, but I think a High and Low could be very useful.

Milan0’s picture

"its not exactly this issue"

Yes it is...if you encode them in h264 with an mp4 extension they should be picked up by the native player if there's a html5 video tag fallback, regardless of the bitrate.
Unfortunatly the module only supports flashplayers with no fallback :(

patrickroma’s picture

Are you planning to implement a fallback option featuring html5?

jlanclos’s picture

Here is what I did to get videos playing on the iPhone/iPad.

added the following to modules/bd_video/includes in function _bd_video-player_render

/* Existing code: */
    $config['playlist'][] = _bd_video_player_clip($video) +
      array(
        'onStart' => 'new Function("this.getControls().show();")',
        'onFinish' => 'new Function("this.getControls().hide();")',
      );
  }

/* Added for iPhone/iPad  */

if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod'))
   {

     $src=storage_api_serve_url($video['flv_file']);
     $output = "<a href=\"$src\">$contents</a>";

  } else  {
  $output = theme_flowplayer($config, 'flowplayer' . $player_id, $attributes, $contents);
  }
  $player_id++;
  return $output;
}

Also iPhone/iPad requires HTTP_RANGE download for movies. Apache does this, but since the files are getting served up via php, it doesn't work.
Here's the code to enable the Storage API fs_drupal to use HTTP_RANGE:
In modules/storage_api/services/fs_drupal/storage_fs_drupal.module :
replace function storage_fs_drupal_storage_object_instance_serve and add storage_fs_drupal_rangeDownload:

/**
 * Implement hook_storage_object_instance_serve() .
 */
function storage_fs_drupal_storage_object_instance_serve($container, $file) {
  storage_api_set_http_headers($file);

  if (isset($_SERVER['HTTP_RANGE']))
   {
     @storage_fs_drupal_rangeDownload($container['settings']['path'] . '/' . $file['object_id']);
      exit();
   }
  
  @readfile($container['settings']['path'] . '/' . $file['object_id']);
  exit();
}


function storage_fs_drupal_rangeDownload($file)
{
        $fp = @fopen($file, 'rb');

        $size   = filesize($file); // File size
        $length = $size;           // Content length
        $start  = 0;               // Start byte
        $end    = $size - 1;       // End byte
        // Now that we've gotten so far without errors we send the accept range header
        /* At the moment we only support single ranges.
         * Multiple ranges requires some more work to ensure it works correctly
         * and comply with the spesifications: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
         *
         * Multirange support annouces itself with:
         * header('Accept-Ranges: bytes');
         *
         * Multirange content must be sent with multipart/byteranges mediatype,
         * (mediatype = mimetype)
         * as well as a boundry header to indicate the various chunks of data.
         */
        header("Accept-Ranges: 0-$length");
        // header('Accept-Ranges: bytes');
        // multipart/byteranges
        // http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
        if (isset($_SERVER['HTTP_RANGE']))
        {
                $c_start = $start;
                $c_end   = $end;
                // Extract the range string
                list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
                // Make sure the client hasn't sent us a multibyte range
                if (strpos($range, ',') !== false)
                {
                        // (?) Shoud this be issued here, or should the first
                        // range be used? Or should the header be ignored and
                        // we output the whole content?
                        header('HTTP/1.1 416 Requested Range Not Satisfiable');
                        header("Content-Range: bytes $start-$end/$size");
                        // (?) Echo some info to the client?
                        exit;
                }
                // If the range starts with an '-' we start from the beginning
                // If not, we forward the file pointer
                // And make sure to get the end byte if spesified
                if ($range{0} == '-')
                {
                        // The n-number of the last bytes is requested
                        $c_start = $size - substr($range, 1);
                }
                else
                {
                        $range  = explode('-', $range);
                        $c_start = $range[0];
                        $c_end   = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
                }
                /* Check the range and make sure it's treated according to the specs.
                 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
                 */
                // End bytes can not be larger than $end.
                $c_end = ($c_end > $end) ? $end : $c_end;
                // Validate the requested range and return an error if it's not correct.
                if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size)
                {
                        header('HTTP/1.1 416 Requested Range Not Satisfiable');
                        header("Content-Range: bytes $start-$end/$size");
                        // (?) Echo some info to the client?
                        exit;
                }
                $start  = $c_start;
                $end    = $c_end;
                $length = $end - $start + 1; // Calculate new content length
                fseek($fp, $start);
                header('HTTP/1.1 206 Partial Content');
        }
        // Notify the client the byte range we'll be outputting
        header("Content-Range: bytes $start-$end/$size");
        header("Content-Length: $length");

        // Start buffered download
        $buffer = 1024 * 8;
        while(!feof($fp) && ($p = ftell($fp)) <= $end)
        {
                if ($p + $buffer > $end)
                {
                        // In case we're only outputtin a chunk, make sure we don't
                        // read past the length
                        $buffer = $end - $p + 1;
                }
                set_time_limit(0); // Reset time limit for big files
                echo fread($fp, $buffer);
                flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
        }

        fclose($fp);
}   

dlumberg’s picture

subscribe

bcobin’s picture

subscribe

dgarigen’s picture

Has anyone implemented the feature that you requested? If not, then please let me know, and I'd be happy to quote it.

izmeez’s picture

subscribe