0
votes

I am using the following to display one .mp4 file in the browser:-

<![if !IE]> 
    <video width="480" height="360" controls="controls">
        <source src="<?php echo $video; ?>" type="video/mp4">
        <param name="src" value="<?php echo $video; ?>" />
        <param name="autoplay" value="true" />
    </video>
<![endif]>

<!--[if IE]>
    <object width="480" height="360" type="application/x-mplayer2" codebase="http://www.microsoft.com/Windows/MediaPlayer/">
    <param name="Filename" value="<?php echo $video; ?>">
    <param name="AutoStart" value="true">
    <param name="ShowControls" value="true">
    <param name="BufferingTime" value="2">
    <param name="ShowStatusBar" value="true">
    <param name="AutoSize" value="true">
    <param name="InvokeURLs" value="false">
    </object>
<![endif]-->

In IE, it is displaying the file but it is not working in chrome. However, if I use the same code and change src to a video located on web already, it works:-

<video width="480" height="360" controls="controls">
        <source src="http://ia700204.us.archive.org/2/items/Pbtestfilemp4videotestmp4/video_test_512kb.mp4" type="video/mp4">
        <param name="src" value="http://ia700204.us.archive.org/2/items/Pbtestfilemp4videotestmp4/video_test_512kb.mp4" />
        <param name="autoplay" value="true" />
    </video>

I have also tried the embed code:-

<embed src="<?php echo $video; ?>" type="application/x-mplayer2" autostart="1" enabled="1" showstatusbar="1" showdisplay="1" showcontrols="1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" width="480" height="360"></embed>

If it is a problem with code, then even the .mp4 file available on net should not play. If it is a problem with source, the file should not play in Internet explorer.

Can someone help me with the issue?

1
do you need this <param name="src" value="<?php echo $video; ?>" />btevfik
can you confirm that the video in $video is a .mp4 and that the path is right? also I'd suggest you use the html5 <video> tag with proper fallback to solve this rather than complicate things with IE/!IE if you can (you can also use canPlayType to test for support for .mp4/.webm/.ogg as needed)Offbeatmammal
I tried removing both the param names but it still doesn't stream the video.user1439090
The path is correct and it is a .mp4 file. I cannot use .webm/.ogg files as the users would be uploading the files in .mp4 format and other users will be viewing the file in their own browsers. I cannot ask the users to upload it in all the formats.user1439090

1 Answers

0
votes

The answer is really easy all you needed to do is this

<embed src="http://ia700204.us.archive.org/2/items/Pbtestfilemp4videotestmp4/video_test_512kb.mp4" height="200" width="500" />

This is just the easiest possible solution and I'm sure there are different ways too.