Hello everyone,

I am trying to play a HTML5 Video using a MP4 file hosted in Amazon S3. I found a file called S3.php and this is the method that I am using

    public static function getAuthenticatedURL($bucket, $uri, $lifetime, $hostBucket = false, $https = true)
    {
        $expires = time() + $lifetime;
        $uri = str_replace(array('%2F', '%2B'), array('/', '+'), rawurlencode($uri)); // URI should be encoded (thanks Sean O'Dea)
        return sprintf(($https ? 'https' : 'http').'://%s/%s?AWSAccessKeyId=%s&Expires=%u&Signature=%s',
        // $hostBucket ? $bucket : $bucket.'.s3.amazonaws.com', $uri, self::$__accessKey, $expires,
        $hostBucket ? $bucket : 's3.amazonaws.com/'.$bucket, $uri, self::$__accessKey, $expires,
        urlencode(self::__getHash("GET\n\n\n{$expires}\n/{$bucket}/{$uri}")));
    }

Then, in the HTML 5 Video, I will use the Authenticated URL and use it as the video source. It worked on Chrome, but in IE9 the video does not play.

Can you please give some examples or references on how to work on this.

thanks in advance.

Hi,

Did you try to add a simple fall back to flash player codes? The reason is that some browser does not support other video formats in html5 player.

For example, chrome does support mp4/h264 videos, while some browsers can only support Ogg, and other support only webm.

So, my recommendation can be costly and if you are paying someone to encode your videos. here is a classic codes for html5 player supporting chrome and firefox..

 <video width="600" height="380" >
 <!-- this can be viewed in chrome -->
 <source src="movie.mp4" type="video/mp4" />
 <!-- this is for firefox ------>
 <source src="movie.ogg" type="video/ogg" />

</video> 

If you don't want spending an extra dime or nickles on ogg format, the best way is to just fallback to flash. Html5 player is still a big hype at this very moment., Internet browser developers should agreee on which is the video format they can agreed upon. Not until then, we will just have to have a complete duplicates of the same video in different format.

The fallback can be something like this..depending on your flash player..

 <video width="600" height="380" >
 <!-- this can be viewed in chrome -->
 <source src="movie.mp4" type="video/mp4" />
 <!-- this is for firefox ------>
 <source src="movie.ogg" type="video/ogg" />

<embed
  id='single2'
  name='single2'
  src='YourOWnplayer.swf'
  width='600'
  height='380'
  bgcolor='#000000'
  allowscriptaccess='always'
  allowfullscreen='true'
  flashvars='file=video.mp4'
/>
</embed>

</video>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.