Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

No video just audio if Internet Explorer refreshed

12 replies [Last post]

Hi,

Upon refreshing the page in IE the video doesn't play anymore but just plays the audio. It works fine in Firefox and if you embed it directly. Below is the code I am using:

<script type="text/javascript" src="/lib/swf_player/swfobject.js"></script>
<script type="text/javascript">

function createPlayer(thePlayer, theFile) {
var flashvars = {
file:theFile,
autostart:"true",
controlbar:"none"
}

var params = {
allowfullscreen:"true",
allowscriptaccess:"always"
}

var attributes = {
id:thePlayer, 
name:thePlayer
}

swfobject.embedSWF("player.swf", "placeholder1", "250", "150", "9.0.115", false, flashvars, params, attributes);
}
</script>

<body bgcolor="#DDDDDD" onload="createPlayer('player1', 'get_healthy.flv')">
<div style="margin-top: -180px; margin-right: 165px; float: right;"><h3><a href="http://www.gethealthynsw.com.au/">Get Healthy</a></h3></div>
<div class="clear-hidden"></div>
<div style="margin-top: -160px; float: right; border: 2px solid #336699;">
<div id="placeholder1">
<a href="http://www.adobe.com/go/getflashplayer">Get flash</a> to see this player
</div>
</div>
</body>

I am clueless!!

    <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>

    <script type="text/javascript">
      var flashvars =
      {
        file:                'get_healthy.flv',
        autostart:           'true'
        id:                  'player1',
        controlbar:          'none',
        autostart:           'true'
      };

      var params =
      {
        allowfullscreen:     'true',
        allowscriptaccess:   'always'
      };

      var attributes =
      {
        id:                  'player1',
        name:                'player1'
      };

      swfobject.embedSWF('player.swf', 'placeholder1', '250', '150', '9.0.124', false, flashvars, params, attributes);
    </script>

  </head>

  <body bgcolor="#DDDDDD">

Let swfobject monitor the DOM loading and determine when to write the object element for embedding the player.

How do I use JS controls then? Plus this doesn't work anyway

Fixed:

   <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>

    <script type="text/javascript">
      var flashvars =
      {
        file:                'get_healthy.flv',
        id:                  'player1',
        controlbar:          'none',
        id:                  'player1',
        autostart:           'true'
      };

      var params =
      {
        allowfullscreen:     'true',
        allowscriptaccess:   'always'
      };

      var attributes =
      {
        id:                  'player1',
        name:                'player1'
      };

      swfobject.embedSWF('player.swf', 'placeholder1', '250', '150', '9.0.124', false, flashvars, params, attributes);
    </script>

  </head>

  <body bgcolor="#DDDDDD">

[i]"How do I use JS controls then?"[/i]

What do you mean by this? You didn't have any JavaScript API code in the code that you posted above.

This is what I want to do.

<head>
<script src="/lib/swf_player/swfobject.js"></script>
    <script type="text/javascript">
      var player = null;
  function playerReady(thePlayer)
  {
player = window.document[thePlayer.id];
  };

  function createPlayer()
  {
  var flashvars =
      {
        file: "/lib/swf_player/get_healthy.flv",
        autostart:"true",
        controlbar:"none"
      };

      var params =
      {
        allowfullscreen:"true",
        allowscriptaccess:"always"
      };

      var attributes =
      {
        id:"player1",
        name:"player1"
      };

  swfobject.embedSWF("/lib/swf_player/player.swf", "placeholder1", "250", "150", "9.0.124", false, flashvars, params, attributes);
  }
    </script>
</head>
<body onload="createPlayer();">
<table>
<tr>
<td>
<div id="placeholder1">
<a href="http://www.adobe.com/go/getflashplayer">Get flash</a> to see this player
</div>
</td>
<td>
<li><a href="#" onclick="player.sendEvent('VOLUME', 50)">UnMute</a></li>
<li><a href="#" onclick="player.sendEvent('MUTE')">Mute</a></li>
</td>
</tr>
</table>
</body>

So if I put ID tags in Flashvars would it be alrite?

Sorry let me be a bit clear. If I don't have the createplayer() on onload(), how do I set the mute etc from the outside? Right now, I have a onClick event that mutes the player. Thanks.

To use the JavaScript API, you only need to set the name & id attributes and the id flashvar, which is in the code that I posted.

To simplify things a bit, you can get the player reference object once, then re-use it. I added the code in bold to do this.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

  <head>

    <title>BK - JWMP v4.5.x - swfobject v2.1</title>

    <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>

    <script type="text/javascript">
      <strong>var player;</strong>

      <strong>function playerReady(obj)</strong>
      <strong>{</strong>
        <strong>player = document.getElementById(obj.id);</strong>
      <strong>};</strong>

      var flashvars =
      {
        file:                'get_healthy.flv',
        id:                  'player1',
        controlbar:          'none',
        id:                  'player1',
        autostart:           'true'
      };

      var params =
      {
        allowfullscreen:     'true',
        allowscriptaccess:   'always'
      };

      var attributes =
      {
        id:                  'player1',
        name:                'player1'
      };

      swfobject.embedSWF('player.swf', 'placeholder1', '250', '150', '9.0.124', false, flashvars, params, attributes);
    </script>

  </head>

  <body>

    <table>
      <tr>
        <td>
          <!-- keep the next line all on one line so you don't end up with a 5px margin below the player -->
          <div id="placeholdercontainer1"><a id="placeholder1" href="http://www.adobe.com/go/getflashplayer">Get flash to see this player.</a></div>
        </td>
        <td>
          <li><a href="#" onclick="player.sendEvent('VOLUME', 50); return false;">UnMute</a></li>
          <li><a href="#" onclick="player.sendEvent('MUTE'); return false">Mute</a></li>
        </td>
      </tr>
    </table>

  </body>

</html>

It's highly recommended that you load swfobject v2.1 from Google's CDN for the following reasons:

Loading from Google AJAX Libraries API

    http://pipwerks.com/journal/2008/11/11/swfobjectjs-finds-a-home-on-google-servers/

How & Why You Should Use Google CDN

    http://webmuch.com/how-why-you-should-use-google-cdn/

<head>
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>

<script type="text/javascript">
      var player = null;
  function playerReady(thePlayer)
  {
player = document.getElementById(thePlayer.id);
  };

  var flashvars =
      {
        file: "/lib/swf_player/get_healthy.flv",
        id:"player1",
        controlbar:"none",
        id:"player1",
        autostart:"true"
      };

      var params =
      {
        allowfullscreen:"true",
        allowscriptaccess:"always"
      };

      var attributes =
      {
        id:"player1",
        name:"player1"
      };

  swfobject.embedSWF("/lib/swf_player/player.swf", "placeholder1", "250", "150", "9.0.124", false, flashvars, params, attributes);
    </script>
</head>
<body>
    <table>
    <tr>
    <td>
    <div id="placeholdercontainer1"><a id="placeholder1" href="http://www.adobe.com/go/getflashplayer">Get flash to see this player</a></div>
    </td>
<td>
<a href="#" onclick="player.sendEvent('VOLUME', 50); return false;">Unmute</a>
<a href="#" onclick="player.sendEvent('MUTE'); return false;">Mute</a>
</td>
</tr>
</table>
</body>

This is what I did and still the refreshing in IE draws a blank when you do it the 2nd time !!!!!!

I use this script as an include in my page, dunno if that changes anything. Any ideas?? This is really frustrating

Unfortunately, I can't reproduce this issue. It's probably dependent on a particular version of IE7, a particular version of the Adobe Flash Player, and the phase of the moon.

Here are some other things that you can try:

1) use swfobject v2.2<script src="http://ajax.googleapis.com/ajax/libs/swfobject/<strong>2.2</strong>/swfobject.js"></script>
2) try a different release of the JW FLV Player from here: http://developer.longtailvideo.com/trac/log/trunk/as3/player.swf
Click on the release that you want in the Rev column,

3) specify a valid DOCTYPE (the first line in the code that I posted above),

4) KICK IT! (often works when all else fails).    :D

hehe...but I figured out a way to fix it though...I am using the latest swf (as3, I think) and tried the date time hack when embedding and it works!!

swfobject.embedSWF('player.swf'+ cacheHack(), 'placeholder1', '250', '150', '9.0.124', false, flashvars, params, attributes);

function cacheHack()
{
   return "?t=" +new Date().getTime();
}

Thanks for your help anyway :)

Looks like you've kicked a goal!

Video Acceleration could be the problem.

I had the same problem. Both IE 6 and Mozilla firefox were not able to stream videos. I was getting only audio but no video.

Do the following

Start -> all programs -> window medial player -> tools -> options -> performance

Take the video acceleration button to zero.

I also was getting this issue. After a clear cache, player would load video fine. But after a refresh or switching to any other page the player would load play a video but with no display, only audio. A right click , switch stretch would force a redraw and the video/display would appear.

Turning off acceleration in Windows Media Player options -> performance sure did the trick. What confuses me is that this issue did not occur on the default 4.6 longtail player, but only on my skinned version.