[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [76] Rework of the auto playback code.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [76] Rework of the auto playback code. |
Date: |
Thu, 19 May 2011 13:31:37 +0000 |
Revision: 76
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=76
Author: valkov
Date: 2011-05-19 13:31:36 +0000 (Thu, 19 May 2011)
Log Message:
-----------
Rework of the auto playback code. Now all objects are checked if they are
started. The autostart for an object starts if no other started video is found.
Modified Paths:
--------------
trunk/src/lm_constructors.js
trunk/src/lm_create_video_object.js
trunk/src/lm_interface_player_web_buttons.js
trunk/src/lm_video_and_flash_objects_helper_functions.js
Modified: trunk/src/lm_constructors.js
===================================================================
--- trunk/src/lm_constructors.js 2011-05-19 12:59:28 UTC (rev 75)
+++ trunk/src/lm_constructors.js 2011-05-19 13:31:36 UTC (rev 76)
@@ -257,8 +257,10 @@
this.player.set_player_name.apply(this,[id]);
var self = this;
- // We only start the firs clip
- if (this.autostart && id ==0)
+ var started_clip = this.find_started_clip();
+
+ // Only start the clip, if not other is playing.
+ if (this.autostart && started_clip == null)
{
// Sometimes it skips seconds if the
// interval is 1sec
Modified: trunk/src/lm_create_video_object.js
===================================================================
--- trunk/src/lm_create_video_object.js 2011-05-19 12:59:28 UTC (rev 75)
+++ trunk/src/lm_create_video_object.js 2011-05-19 13:31:36 UTC (rev 76)
@@ -257,9 +257,12 @@
message.textContent = this._("Waiting for video plugin...");
param.setAttribute("name", "autoplay");
- // Start only the first found clip
- param.setAttribute("value", (id > 0) ? "false" : this.autostart);
+ // Find if a clip is already playing.
+ var started_clip = this.find_started_clip();
+ param.setAttribute("value",
+ (started_clip !== null) ? "false" : this.autostart);
+
object_tag.appendChild(param);
param = document.createElement("param");
Modified: trunk/src/lm_interface_player_web_buttons.js
===================================================================
--- trunk/src/lm_interface_player_web_buttons.js 2011-05-19 12:59:28 UTC
(rev 75)
+++ trunk/src/lm_interface_player_web_buttons.js 2011-05-19 13:31:36 UTC
(rev 76)
@@ -37,6 +37,8 @@
var self =this;
+ var started_clip = this.find_started_clip();
+
var play = document.createElement("a");
play.setAttribute("class", "linterna-magica-controls-buttons "+
"linterna-magica-controls-buttons-play");
@@ -44,11 +46,12 @@
play.setAttribute("title", this._("Play"));
play.textContent ="Pl";
// Only pause button should be visible on autostart
- // Auto start only the firs object in the page
- if (this.autostart && id == 0)
+ // Auto start only if no other clip is playing.
+ if (this.autostart && started_clip == null)
{
play.style.setProperty("display", "none", "important");
}
+
var play_click_function = function(ev)
{
ev.preventDefault();
@@ -76,8 +79,9 @@
pause.setAttribute("href", "#");
pause.setAttribute("title", this._("Pause"));
pause.textContent ="Pa";
- // Only play button should be visible if !autostart (and
- if (!this.autostart || id !=0)
+ // Only play button should be visible if !autostart or another
+ // clip is strated.
+ if (!this.autostart || started_clip !== null)
{
pause.style.setProperty("display", "none", "important");
}
Modified: trunk/src/lm_video_and_flash_objects_helper_functions.js
===================================================================
--- trunk/src/lm_video_and_flash_objects_helper_functions.js 2011-05-19
12:59:28 UTC (rev 75)
+++ trunk/src/lm_video_and_flash_objects_helper_functions.js 2011-05-19
13:31:36 UTC (rev 76)
@@ -189,3 +189,23 @@
return flash_object;
}
+
+// Check all video objects to find if one is started.
+LinternaMagica.prototype.find_started_clip = function()
+{
+ var started = null;
+
+ for (var i=0,l=this.found_flash_video_objects; i<l; i++)
+ {
+ // Another clip is started
+ if (this.get_video_object(i) &&
+ this.player.state(i).string)
+ {
+ started = i;
+ break;
+ }
+ }
+
+ return started;
+}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [76] Rework of the auto playback code.,
Ivaylo Valkov <=