This is a message.

Forum user: PaulOgilvie

Basic information

Registered Feb 15, 2009
Last login Mar 29, 2011
Forum posts 61
Direct URL http://www.flowplayer.org/forum/users/8377

Latest forum posts

Posts:

Registered:

» » » » » How to track video TIME watched by user

Posted: Jun 21, 2009

If you have a (global) variable somewhere that tracks time, you can also use a global variable to hold the last time you updated the global time tracking variable, and at the body unload event ask the time again and subtract the two. Now you know the time until the user left the page. For example:

var gTotalTime=0;
var gLastTime, gPlaying;
...
onPause:function() {
  gTotalTime += (your calculation);
  gLastTime= new Date();
  gPlaying= false;
}
...
function exit(){
 if (gPlaying) gTotalTime += (new Date() - gLastDate);
}
...
<body onUnload="exit()">

Posts:

Registered:

» » 2 diferent players on one site ?

Posted: Jun 19, 2009

You call flowplayer() (that is, without parameter), but that gets the FIRST player of the players array. That might not be the player you intend.

Posts:

Registered:

» IE Hangs on page load

Posted: Jun 19, 2009

If you still have the problem, please post an example.

Posts:

Registered:

» » » » » » » automatically expose and start multiple players

Posted: Jun 19, 2009

OK. This is where "advanced debugging" steps in. Goal is to create a clear and repeatable situation that shows the problem.
For me the first step would be to remove the expose() stuff and to change how the next player is loaded. The first you can do yourself. For the second, try:

  onUnload:function() {
    // pick a random flowplayer instance and start it
    var offset = Math.floor(Math.random()*($("a.xp").length));
    setTimeout('test('+String(offset)+');', 2000);
  },
  ...
 });
}
function test(offset) {
  $f(offset).load().play();
}
I set the timeout extgremely long (2 seconds) just to check it is working. Next try to set to e.g. 10 millisecond. The idea is to give Flowplayer enough time to unload before you do anything else.

Posts:

Registered:

» » » » » automatically expose and start multiple players

Posted: Jun 19, 2009

I have it working now with 6 videos. It all works fine (IE7, flowplayer311, jquery/expose102):

<script src="http://cdn.jquerytools.org/1.0.2/jquery.tools.min.js"></script>
<script src="flowplayer-3.1.1.min.js"></script>

<script>
function myPlay()
{
	$f("a.xp", {src: "flowplayer-3.1.1.swf", loop: false}, {
          clip: {
             scaling: 'fit',
             autoBuffering: true,
             autoPlay: true,
             onStart:function() {
                  var self= this;
				 $(this.getParent()).expose({
                   	api: true,
                   	opacity: 0.8
                 }).load().onClose(function() {
                     self.stop();
                 });
             },
             onStop:function() {
                 this.unload();
             },
             onFinish:function() {
                 $(this.getParent()).expose({api: true}).close();
                 this.stop();
                 this.unload();
             }
         },
         onUnload:function() {
             // pick a random flowplayer instance and start it playing
             var offset = Math.floor(Math.random()*($("a.xp").length));
             $f(offset).load().play();
         },
         plugins: { controls: null },
         play: { opacity: 0 }
     });
}
</script>
</head>

<body onload="myPlay();">

Note: added "var" to "var offset=..." but should not be the difference (unless a variable 'offset' is used elsewhere: without the var it becomes a global variable where you only need a local one).

Posts:

Registered:

» » » disabling flowplayer controls on click

Posted: Jun 18, 2009

Note: $f() returns the FIRST player of the players array. If you use mutliple players on a page you must pass a parameter to $f() to address a specific player:

function show_controls(player) {
  $f(player).etcetera()

Posts:

Registered:

» » » automatically expose and start multiple players

Posted: Jun 18, 2009

Think I found your bug: your call to flowplayer() and $f() (without arguments!) returns the FIRST player of the player array. You don't want that. you want the CURRENT player!
Use:

clip: {
  ...
  onStart:function() {
    var self= this;
    $(this.getParent()).expose({
      api: true,
      opacity: 0.8
    }).load().onClose(function() {
          self.stop();
    });
  },
  onStop:function() {
     this.unload();
  },
  onFinish:function() {
    $(this.getParent()).expose({api: true}).close();
    this.stop();
    this.unload();
  },
  ...
Note the 'var self= this' to capture the current player in the onStart and note use of 'this' in stead of '$f()' in onStop and onFinish.

I tested it and it works. Looks neat b.t.w.

Posts:

Registered:

» disabling flowplayer controls on click

Posted: Jun 18, 2009

Did you try $f().getControls().hide() and show()?

See http://www.flowplayer.org/documentation/api/plugin.html#methods for hide and show and see http://www.flowplayer.org/plugins/flash/controlbar.html for controlbar documentation.

Posts:

Registered:

» automatically expose and start multiple players

Posted: Jun 18, 2009

I'll make an attempt at some help....

Unload in the api docs says: "Unloads the player Flash component and replaces it with the original HTML content of the container element. This method does nothing if the player is full screen or if there was no html in the container."

Looking at the Flowplayer javascript source:

// unload only if in splash state
if (html.replace(/s/g,'') !== '') {
  if (self._fireEvent("onBeforeUnload") === false) {
    return self;
  }	
  api.fp_close();
  api = null;				
  wrapper.innerHTML = html;				
  self._fireEvent("onUnload");
} 
So api.fp_close() is only called when there was some html in the container and otherwise does nothing. I am not sure about the significance of the 'api.fp_close()' call, but it does seem that without html it indeed does nothing, so your player is NOT unloaded. Neither am I sure what happens when you replace the player in the container with something else. It should be the browser that should see the object is removed from the tag and the browser should destroy the object (whatever 'destroying' means).

Could you try with a splash image or a "hello" so there is html in the container? Note that all other players will receive an unload event then, so be sure that their onBeforeUnload retruns false.

p.s.: why load/unload players? Why not just load it once, use show() and hide() and use play(Clip)?

Posts:

Registered:

» » » » » Single quote - again!

Posted: Jun 17, 2009

'-' (minus sign) is %2D, not %3A (I reaallly need to check aallll the details!).

Bug confirmed and entered in issue list.

Posts:

Registered:

» » » Single quote - again!

Posted: Jun 17, 2009

So you only want to escape the filename's special characters.

Use:

var codedURL, temp;
codedURL= "And&plus+min-and'";
temp= escape(codedURL);
temp= temp.replace(/\+/g,'%2B');
temp= temp.replace(/-/g,'%3A'); 
temp= 'http://sirio:81/stream/7/' +temp;
Output:

http://sirio:81/stream/7/And%26plus%2Bmin%3Aand%27
Note that '+' is a special character in a regular expression, so you should write \+ to escape it. Use the escape function to escape all other funny characters:
"The escape function encodes special characters in the specified string and returns the new string. It encodes spaces, punctuation, and any other character that is not an ASCII alphanumeric character, with the exception of these characters:
* @ - _ + . /
"

Posts:

Registered:

» » » How to track video TIME watched by user

Posted: Jun 17, 2009

Use the player's getTime() to get the time of the current clip.
Seehttp://www.flowplayer.org/documentation/api/player.html#methods

I am not sure if that is available at the body onUnload event - player might have been unloaded already (but don't think so - please test its behavior).

I don't think (expect) 200 embedded cuepoints should be a problem.

Posts:

Registered:

» » flowplayer 2 works on localhost, version 3 not, why?

Posted: Jun 16, 2009

Argh... setting a bit in Flash. Just add the local domain to the security settings and it will work local and global.

Posts:

Registered:

» Single quote - again!

Posted: Jun 16, 2009

Please provide an example.

Posts:

Registered:

» » getAttribute is not a function

Posted: Jun 16, 2009

You may be weel ahead of me ehre...

It does mean that $('#4739') returns something that does not have a getAttribute function.

Add some debugging code to check what $('#4739') returns.