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

Forums

/

Link in the logo AND a movie loading before

5 replies [Last post]

Hi..I have a problem: I have 2 kinds of different configurations possible for the flv player, that works fine separately, but not together. The first one loads 2 movie in the same player

The first one loads a youtube movie, but before it, he loads a pre-movie with an advertising, that is a flv movie. The example is here:

http://casa.abril.com.br/video/nova_index.shtml

and it works via javascripting with a line like this:

swfobject.embedSWF("player.swf", "exibeAqui", w, h, "9.0.115", false, flashvars, params, attributes); inside the js, within a function called do_player

and, in the html:

<script type="text/javascript">
do_player("http://www.youtube.com/watch?v=vwIhgTXRiEo", "exibeAqui","460","370",true,true);
</script>

You can see the full code of the js file, if you visit the page I put as example.

------------------------------------------------------------------------

The other way, works fine, with an image with a hyperlink on it, but the code to make it works is something like that:

<script type='text/javascript'>
  var s1 = new SWFObject('player.swf','ply','470','280','9','#ffffff');
  s1.addParam('allowfullscreen','true');
  s1.addParam('allowscriptaccess','always');
  s1.addParam('wmode','opaque');
  s1.addParam('flashvars','file=http://content.bitsontherun.com/videos/3ta6fhJQ.flv&controlbar=over&logo=http://www.longtailvideo.com/jw/upload/longtail.png&link=http://www.longtailvideo.com&displayclick=link&screencolor=FFFFFF&autostart=true');
  s1.write('container');
</script>

The page with the example is here:
http://casa.abril.com.br/video/novoteste2.html

As you see, there are two different versions of a swf function used in both cases. I want to know, how I can adapt it to work together

Please, if you help me it will be really helpful
my msn is this: rafael_headstrong@hotmail.com
i'm online the whole day at work I appreciate

 
http://casa.abril.com.br/video/nova_index.shtml

Your first embedding script uses swfobject v2.1.

Your second embedding script uses SWFObject v1.5.

To convert your second script to swfobject v2.1, load swfobject v2.1 once in the head element of your HTML document, like this:

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

Then use this code in the head element of your HTML document:

    <script type="text/javascript">
      var flashvars =
      {
        'file':                         'http://content.bitsontherun.com/videos/3ta6fhJQ.flv',
        'controlbar':                   'over',
        'logo':                         'http://www.longtailvideo.com/jw/upload/longtail.png',
        'displayclick':                 'link',
        'link':                         'http://www.longtailvideo.com',
        'screencolor':                  'FFFFFF',
        'id':                           'player1',
        'autostart':                    'true'
      };

      var params =
      {
        'allowfullscreen':              'true',
        'allowscriptaccess':            'always',
        'wmode':                        'opaque',
        'bgcolor':                      '#FFFFFF'
      };

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

      swfobject.embedSWF(player, 'player1', '470', '280', '9.0.124', false, flashvars, params, attributes);
    </script>

The player will appear whereever you place this:

    <div id="playercontainer" class="playercontainer"><a id="player" class="player" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Flash Player to see this Media Player.</a></div>

Hey Lefty. Thanks for your help.
That question is solved now :)

I just have a problem now: my player doesnt work in IE 6

http://casa.abril.com.br/video/nova_index.shtml

I'm trying to figure it out what is wrong, but I can't find ( this damn IE never had and it will never have a decent debugger )

Can you give me just one more help on this? ( or anyone)

Thanks!!

 
Your page is hanging on the Google Urchin Tracker and other JavaScript scripts.

IE throws these errors:

1) Line 66 Char 2

3) Line 219 Char 1

3) Line 234 Char 10

4) Line 366 Char 2

These are errors with various scripts that you are loading. Try commenting them out, then add them one-at-a-time and debug them.

I already had tried to do that, and it didnt work
Look at this page:

http://casa.abril.com.br/video/nova_index2.shtml

Error on 1) Line 41 Char 2

here's the whole code of the page, without its layout and anything

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="pragma" content="nocache" />
<meta name="robots" content="NOARCHIVE"/>
<meta name="author" content="Editora Abril S/A" />
<meta name="content-language" content="pt-br" />
<meta name="title" content="TV Casa - casa.com.br" />
<meta name="classification" content="/" />
    <!--<META HTTP-EQUIV="Refresh" CONTENT="170"> -->

<title>TV Casa - casa.com.br</title>

<link rel="alternate" title="casa.com.br - RSS" href="http://casa.abril.com.br/rss/noticias.xml" type="application/rss+xml" />

<script type="text/javascript">
videoAtual = 'via_italia_03_200'
imagemAtual = 'preview.jpg';
</script>
<!--<script type="text/javascript" src="swfobject.js"></script>-->
<script type="text/javascript" src="tv-casa.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>

</head>

<body>

<div id="exibeAqui"></div>
<script type="text/javascript">
player("http://www.youtube.com/watch?v=5apPdZXNELc", "exibeAqui","460","370",true,true);

    </script>
</body>
</html>

The error points to here:
player("http://www.youtube.com/watch?v=5apPdZXNELc", "exibeAqui","460","370",true,true);

It doesn't make any sense :(

Get a v4.4.162 player from here:

      http://developer.longtailvideo.com/trac/browser/trunk/as3?rev=165

Here's your HTML document:

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

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

  <head>

    <title>TV Casa - casa.com.br</title>

    <link rel="shortcut icon" href="/favicon.ico" />
    <link rel="alternate" title="casa.com.br - RSS" href="http://casa.abril.com.br/rss/noticias.xml" type="application/rss+xml" />

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta http-equiv="pragma" content="nocache" />
    <meta name="robots" content="NOARCHIVE"/>
    <meta name="author" content="Editora Abril S/A" />
    <meta name="content-language" content="pt-br" />
    <meta name="title" content="TV Casa - casa.com.br" />
    <meta name="classification" content="/" />
    <!--<META HTTP-EQUIV="Refresh" CONTENT="170"> -->

    <script type="text/javascript">
      videoAtual  = 'via_italia_03_200'
      imagemAtual = 'preview.jpg';
    </script>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>
    <script type="text/javascript" src="http://casa.abril.com.br/video/tv-casa.js"></script>

  </head>

  <body onload="player('http://www.youtube.com/watch?v=5apPdZXNELc', 'exibeAqui', '460', '370', true, true);">

    <div id="exibeAqui"></div>
    <div id="playlist" style="font-family:arial"> </div>

  </body>

</html>

Here's your JavaScript formatted for the "meat" computers (that's us developers):

var tv_va   = {};
var tv_ofer = {};
var tv_com  = {};

tv_ofer[0] = encodeURIComponent('http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x94!x94?.flv'); //CEF
tv_ofer[1] = encodeURIComponent('http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x92!x92?.flv'); //GOL

tv_com[0]  = encodeURIComponent('http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x95!x95?.flv'); //CEF
tv_com[1]  = encodeURIComponent('http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x93!x93?.flv'); //GOL

i_ad_va       = Math.random();
indice_ad_va  = parseInt(i_ad_va * 2);

alert(indice_ad_va);

tv_va[0] =
{
  file:                       tv_ofer[indice_ad_va],
  title:                     'OAS Ad',
  image:                      imagemAtual,
  link:                      'http://www.google.com',
  type:                      'video',
  logo:                      'logo.png',
  displayclick:              'link'
};

tv_va[2] =
{
  file:                       tv_com[indice_ad_va],
  title:                     'OAS Ad',
  image:                      imagemAtual,
  link:                      'http://www.google.com',
  type:                      'video',
  logo:                      'logo.png',
  displayclick:              'link'
};

var va_player   = null;
var va_playlist = null;

function playerReady(obj)
{
  va_player = gid(obj.id);
  loadMeUp();
}

function loadMeUp()
{
  va_playlist = va_player.getPlaylist();
  
  if(va_playlist !== null)
  {
    va_player.sendEvent('LOAD', tv_va);
    dumpPlaylist();
  }
  else
  {
alert('Try Again!');
    setTimeout("loadMeUp();", 50);
  }
};

function dumpPlaylist()
{
  var playlist = va_player.getPlaylist();
  var nodes = '';

  for(var j in playlist)
  {
    nodes += '<br />Track: ' + j + '<br />';

    for(var k in playlist[j])
    {
      nodes += '<li>' + k + ': ' + playlist[j][k] + '</li>';
    }
  }
  gid('playlist').innerHTML = '<br />Playlist:' + nodes;
};

function player(url, container, w, h, start, marca)
{
  var flashvars =
  {
    file:                    'dummy.flv',
    image:                   '',
    logo:                    'logo.png',
    repeat:                  'always',
    displayclick:            'link',
    link:                    'http://www.google.com',
    screencolor:             'FFFFFF',
    id:                      'player_salao',
    autostart:               'true'
  };

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

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

  tv_va[1] =
  {
    file:                     url,
    title:                   'Main'
  };

  swfobject.embedSWF('player-4.4.162.swf', container, w, h, '9.0.124', false, flashvars, params, attributes);
};

function gid(name)
{
  return document.getElementById(name);
};

Here's your JavaScript processed by the Yahoo! Minifier ( http://developer.yahoo.com/yui/compressor/ ), which is what you would use for production code loaded by:  tv-casa.js:

var tv_va={};var tv_ofer={};var tv_com={};tv_ofer[0]=encodeURIComponent("http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x94!x94?.flv");tv_ofer[1]=encodeURIComponent("http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x92!x92?.flv");tv_com[0]=encodeURIComponent("http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x95!x95?.flv");tv_com[1]=encodeURIComponent("http://ads.abril.com.br/RealMedia/ads/adstream_nx.ads/viajeaqui/multimidia@x93!x93?.flv");i_ad_va=Math.random();indice_ad_va=parseInt(i_ad_va*2);alert(indice_ad_va);tv_va[0]={file:tv_ofer[indice_ad_va],title:"OAS Ad",image:imagemAtual,link:"http://www.google.com",type:"video",logo:"logo.png",displayclick:"link"};tv_va[2]={file:tv_com[indice_ad_va],title:"OAS Ad",image:imagemAtual,link:"http://www.google.com",type:"video",logo:"logo.png",displayclick:"link"};var va_player=null;var va_playlist=null;function playerReady(A){va_player=gid(A.id);loadMeUp()}function loadMeUp(){va_playlist=va_player.getPlaylist();if(va_playlist!==null){va_player.sendEvent("LOAD",tv_va);dumpPlaylist()}else{alert("Try Again!");setTimeout("loadMeUp();",50)}}function dumpPlaylist(){var D=va_player.getPlaylist();var B="";for(var C in D){B+="<br />Track: "+C+"<br />";for(var A in D[C]){B+="<li>"+A+": "+D[C][A]+"</li>"}}gid("playlist").innerHTML="<br />Playlist:"+B}function player(A,B,I,H,C,F){var D={file:"dummy.flv",image:"",logo:"logo.png",repeat:"always",displayclick:"link",link:"http://www.google.com",screencolor:"FFFFFF",id:"player_salao",autostart:"true"};var E={allowfullscreen:"true",allowscriptaccess:"always"};var G={id:"player_salao",name:"player_salao"};tv_va[1]={file:A,title:"Main"};swfobject.embedSWF("player-4.4.162.swf",B,I,H,"9.0.124",false,D,E,G)}function gid(A){return document.getElementById(A)};

One last item; be sure that you purchase a commercial license from Longtail Video, because without a commercial license, you are prohibited from displaying ads in or around the JW FLV Media Player.