• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 697
  • Last Modified:

Embed a wmv video on my web page

Hi - I am trying to embed a .wmv video on my web page.  I have tried many options - the only one where it has played so far is if I insert the following code, but unfortunately this only plays on IE, and I need it to be able to play in firefox as well.  Any suggestions?

echo '
<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=240
  CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
  STANDBY="Loading Windows Media Player components..."
  TYPE="application/x-oleobject"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">

  <PARAM name="autoStart" value="True">
  <PARAM name="filename" value="' . $video . '">

<EMBED TYPE="application/x-mplayer2"
    SRC="' . $video . '"
    NAME="MediaPlayer"
    WIDTH=320
    HEIGHT=240>
  </EMBED>
</OBJECT>';





0
PurpleSlade
Asked:
PurpleSlade
  • 11
  • 8
1 Solution
 
Eternal_StudentCommented:
Try and add:

AutoStart=1

To the embed tag
0
 
PurpleSladeAuthor Commented:
No, that didn't do it - I tried

AUTOSTART=1
AUTOSTART="1"
AUTOSTART=TRUE
AUTOSTART="TRUE"
0
 
Eternal_StudentCommented:
When you look at the source code for the template what does the src name equal in the embed tag ?

Ive got a feeling that variable isnt being printed correctly somehow.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PurpleSladeAuthor Commented:
The variable is OK - it plays fine in Internet Explorer and plays right away.  It is just in Firefox that it is playing incorrectly.
0
 
PurpleSladeAuthor Commented:
Actually - I don't mean it is playing incorrectly in Firefox, I mean it is not playing at all.  The window shows but nothing happens.  I tried Quicktime as a plugin but kept getting the broken link to Quicktime.  Is there a better plugin I should be using you think?
0
 
Eternal_StudentCommented:
windows media should be fine .. can you view your source code when previewing it in a browser and paste the whole of the object tag here so I can see what is happening.
0
 
PurpleSladeAuthor Commented:
Absolutely - here it is.  Would setting the width and height values make a difference?  I chose the arbitrary width and height from a cut and paste of the <OBJECT> code.

<html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
      <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
      <link rel="stylesheet" href="../styles/mainpages.css" type="text/css" />
      <title>The Title -- Videos -- </title>
      
</head><body>      <center>
      <div class="bluebottomsilver">
            <img border="0" src="../images/the_site/BannerPhotos3.jpg"><br />
      </div>
      <p>&nbsp;</p>
      <img border="0" src="../images/the_site/banner4.png">
      <p>&nbsp;</p>


      <a href="../index.html">Home</a>
      <a href="mainimagepage.php">Photos</a>
      <a href="../index.php">Forums</a>
      <a href="../forms/MainRosterForm.php">Roster</a>

<p>&nbsp;</p>




<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=240
  CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
  STANDBY="Loading Windows Media Player components..."
  TYPE="application/x-oleobject"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">

  <PARAM name="autoStart" value="True">
  <PARAM name="filename" value="../images/kkdphotos/Videos/The Cig Bet.wmv">

<EMBED TYPE="application/x-mplayer2"
      SRC="../images/kkdphotos/Videos/The Cig Bet.wmv"
    NAME="MediaPlayer"
    WIDTH=320
    HEIGHT=240>
  </EMBED>
</OBJECT><p>&nbsp;</p><p>&nbsp;</p></center></body></html>
0
 
PurpleSladeAuthor Commented:
Here is the source with the autostart parameter:

<html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
      <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
      <link rel="stylesheet" href="../styles/kkdmainpages.css" type="text/css" />
      <title>The Page -- Videos -- </title>
      
</head><body>      <center>

      <div class="bluebottomsilver">
            <img border="0" src="../images/site/BannerPhotos3.jpg"><br />
      </div>
      <p>&nbsp;</p>
      <img border="0" src="../images/site/banner4.png">
      <p>&nbsp;</p>


      <a href="../index.html">Home</a>

      <a href="mainimagepage.php">Photos</a>
      <a href="../index.php">Forums</a>
      <a href="../forms/MainRosterForm.php">Roster</a>

<p>&nbsp;</p>




<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=240
  CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
  STANDBY="Loading Windows Media Player components..."
  TYPE="application/x-oleobject"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">

  <PARAM name="autoStart" value="True">
  <PARAM name="filename" value="../images/photos/Videos/The Cig Bet.wmv">

<EMBED TYPE="application/x-mplayer2"
      AUTOSTART=1
      SRC="../images/photos/Videos/The Cig Bet.wmv"
    NAME="MediaPlayer"
    WIDTH=320
    HEIGHT=240>
  </EMBED>
</OBJECT><p>&nbsp;</p><p>&nbsp;</p></center></body></html>
0
 
Eternal_StudentCommented:
ok your code looks fine .. the only thing I am not sure about is the file name of The Cig Bet .. The spaces should be filled with a % by the server so it shouldnt matter but you might want to hardcode a movie into the embed tag so there are no spaces.

Failing that ! Have you actually tried to upload the code and test it online ? It may be a local problem that will be resolved once the code is "live".

Let me know the outcome.
0
 
PurpleSladeAuthor Commented:
Hi - yes, I tested it without the  spaces, and also uploaded it to the server - same thing happened.  Once I loaded it and a message popped up (for Quicktime) saying that it needed additional software to play the file, but that it wasn't on the server.  That made me think maybe it was a file issue?  I have tried just about every way of doing this under that I can find, including the following, and all of them have the same issue that it will play in IE but not Firefox - and Quicktime won't play it in either browser:

/* echo '
<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=240
  CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
  STANDBY="Loading Windows Media Player components..."
  TYPE="application/x-oleobject"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">

  <PARAM name="autoStart" value="True">
  <PARAM name="filename" value="' . $video . '">

<EMBED TYPE="application/x-mplayer2"
      AUTOSTART=1
      SRC="' . $video . '"
    NAME="MediaPlayer"
    WIDTH=320
    HEIGHT=240>
  </EMBED>
</OBJECT>'; */

/* echo '<embed src="' . $video . '" width="320" height="240" showcontrols="0" />';  */

/* echo '
<object NAME="Player" WIDTH="320" HEIGHT="240" align="left" hspace="10" type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">

<param NAME="URL" VALUE="' . $video . '"><param>
<param NAME="AUTOSTART" VALUE="true"></param>
<param name="showControls" value="true"></param>

<embed WIDTH="320" HEIGHT="240" align="left" hspace="10" SRC="' . $video . '" TYPE="application/x-oleobject" AUTOSTART="true">

</embed>

</object>'; */

/* echo '
<OBJECT ID="WMPlay" width=640 height=480 classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,70" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
<PARAM name="URL" value="' . $video . '">
<PARAM name="DisplaySize" value=0>
<PARAM name="AllowChangeDisplaySize" value="True">
<PARAM NAME=ShowControls VALUE=1>
<PARAM NAME="WindowlessVideo" Value="0">
<PARAM NAME=ShowDisplay VALUE=1>
<PARAM NAME=ShowStatusBar VALUE=1>
<PARAM NAME=AutoStart VALUE=TRUE>
<PARAM NAME=InvokeURLS Value=False>
<embed name="WMplay" width="640" height="480" type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"
src="' . $video . '" Name="Video File" AllowChangeDisplaySize="True" ShowControls="1" AutoStart=True ShowDisplay="0" ShowStatusBar="1">
</embed>
</object>'; */

/*
echo '
<OBJECT id="mediaPlayer" width="320" height="240"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/ mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components…" type="application/x-oleobject">
<param name="fileName" value="' . $video . '">
<param name="animationatStart" value="1">
<param name="transparentatStart" value="1">
<param name="autoStart" value="1">
<param name="ShowControls" value="0">
<param name="ShowDisplay" value="0">
<param name="ShowStatusBar" value="0">
<param name="loop" value="0">
<EMBED type="application/x-mplayer2"
pluginspage="http://microsoft.com/windows/mediaplayer/ en/download/"
id="mediaPlayer" name="mediaPlayer" displaysize="4" autosize="0"
bgcolor="darkblue" showcontrols="0" showtracker="1"
showdisplay="0" showstatusbar="0" videoborder3d="0" width="320" height="240"
src="' . $video . '" autostart="1" designtimesp="5311" loop="0">
</EMBED>
</OBJECT>';

echo "<p/>";

echo '
<OBJECT classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="240" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="' . $video . '">
<param name="autoplay" value="true">
<param name="controller" value="false">
<param name="loop" value="false">
<EMBED src="' . $video . '" width="320" height="240" autoplay="true"
controller="false" loop="false" bgcolor="#000000" pluginspage="http://www.apple.com/quicktime/download/">
</EMBED>
</OBJECT>'; */


echo '
<!--[if !IE]> <-->
    <object type="video/x-ms-wmv" data="' . $video . '" width="320px" height="240px">
        <param name="src" value="' . $video . '" valuetype="ref" type="' . $video . '">
        <param name="animationatStart" value="1">
        <param name="transparentatStart" value="1">
        <param name="autoStart" value="1">
        <param name="ShowControls" value="0">
        <param name="ShowDisplay" value="0">
        <param name="ShowStatusBar" value="0">
        <param name="loop" value="0">
        <param name="displaysize" value="0">
        <strong>Error:</strong> Embedding <a href="' . $video . '">' . $video . '</a> with the <a href="http://www.microsoft.com/windows/windowsmedia/download/plugin.aspx">Windows Media Plugin</a> failed.
    </object>
<!--> <![endif]-->
<!--[if IE]>
    <object type="video/x-ms-wmv" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" width="320px" height="240px">
        <param name="src" value="' . $video . '" valuetype="ref" type="video/x-ms-wmv">
        <param name="animationatStart" value="1">
        <param name="transparentatStart" value="1">
        <param name="autoStart" value="1">
        <param name="ShowControls" value="0">
        <param name="ShowDisplay" value="0">
        <param name="ShowStatusBar" value="0">
        <param name="loop" value="0">
        <param name="displaysize" value="0">
        <strong>Error:</strong> Embedding <a href="' . $video . '">' . $video . '</a> with the Windows Media Plugin failed.  Make sure you have <a href="http://www.microsoft.com/windows/windowsmedia/default.aspx">Windows Media Player</a>.
    </object>
<![endif]-->
0
 
Eternal_StudentCommented:
Can i see this live anywhere ?
0
 
Eternal_StudentCommented:
Here is an example of how I would embed for FF:

<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="filename.wmv" name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1></embed>

Try and adapt to suit your code and hardcode a file name in there ^.
0
 
PurpleSladeAuthor Commented:
I tried hardcoding it in and still no dice - is there a way I could forward you a url of the page?
0
 
PurpleSladeAuthor Commented:
OK - some progress - when I made a test.html page and inserted the following code (renamed it to test.wmv), it plays on the server in both browsers ... still not working when I'm passing it through php with all the other commands though.

<html>
<body>

<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="test.wmv" name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1></embed>

</body>
</html>
0
 
Eternal_StudentCommented:
Can I see the link ?
0
 
Eternal_StudentCommented:
Where the code is php, that is.
0
 
PurpleSladeAuthor Commented:
<?php
      $video = $_GET['vid'];

      $page_title = 'Videos -- ' . $image;
      include('../nonPHPBBincludes/header.inc');

      echo '<body>';
?>
      <center>
      <div class="bluebottomsilver">
            <img border="0" src="../images/kappa_site/BannerPhotos3.jpg"><br />
      </div>
      <p>&nbsp;</p>
      <img border="0" src="../images/kappa_site/kkdbanner4.png">
      <p>&nbsp;</p>

      <a href="../index.html">Home</a>
      <a href="mainimagepage.php">Kappa Photos</a>
      <a href="../index.php">Kappa Forums</a>
      <a href="../forms/MainRosterForm.php">Kappa Roster</a>

<p>&nbsp;</p>

<?php

/* THIS ONE WORKED */
/*      echo '
      <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="http://myurl/images/kkdphotos/Videos/test.wmv" name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1></embed>
      ';
*/

/* THIS ONE DOESN'T */  it gets passed a relative URL which is "../kappas/images/Videos/test.wmv"
      echo '
            <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="http://myurl/' . $video . '" name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1></embed>
      ';

      echo '<p>&nbsp;</p>';
      echo '<p>&nbsp;</p>';
      echo '</center>';
      echo '</body>';
      echo '</html>';
?>

0
 
PurpleSladeAuthor Commented:
I believe I solved it - it didn't like the relative URL being passed as ../images/kkdphotos/Videos/filename.wmv

so I did
$video = str_replace("..", "", $video);

and appended the full domain name to the beginning.  It seems to be working now (crosses fingers)
0
 
PurpleSladeAuthor Commented:
Thanks for your help!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 11
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now