Solved

Embed a wmv video on my web page

Posted on 2006-07-18
19
687 Views
Last Modified: 2012-06-27
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
Comment
Question by:PurpleSlade
  • 11
  • 8
19 Comments
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 17131620
Try and add:

AutoStart=1

To the embed tag
0
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17131676
No, that didn't do it - I tried

AUTOSTART=1
AUTOSTART="1"
AUTOSTART=TRUE
AUTOSTART="TRUE"
0
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 17131792
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 2

Author Comment

by:PurpleSlade
ID: 17131817
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
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17131833
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
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 17131860
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
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17131921
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
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17132003
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
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 17132724
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
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17132772
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
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 17132811
Can i see this live anywhere ?
0
 
LVL 18

Accepted Solution

by:
Eternal_Student earned 500 total points
ID: 17132827
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
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17132965
I tried hardcoding it in and still no dice - is there a way I could forward you a url of the page?
0
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17133175
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
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 17133211
Can I see the link ?
0
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 17133212
Where the code is php, that is.
0
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17133327
<?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
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17133465
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
 
LVL 2

Author Comment

by:PurpleSlade
ID: 17134126
Thanks for your help!
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Find out what you should include to make the best professional email signature for your organization.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question