Bonjour, je ne suis pas du tout developpeur web mais exceptionnellement pour le boulot je dois corriger un bug de lecture d'une vidéo en flash exportée par l'utilisateur a partir de notre logiciel. Une fois la vidéo exportée, on lance un fichier HTML dont le contenu est le suivant :

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!-- saved from url=(0013)about:internet -->
<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<script type="text/javascript" src="js/swfobject.js"></script>
 
		<script type="text/javascript" src="js/range.js"></script>
		<script type="text/javascript" src="js/timer.js"></script>
		<script type="text/javascript" src="js/slider.js"></script>
 
		<script type="text/javascript">
 
      var isLooping = false;
      var intervalId = 0;
      var loadCheckIntervalId = 0;
      var frameSlider = 0;
      var swfFile =  0;
      var totalFrames = 0;
      var blockSliderEvents = false;
      var isPlaying = true;
    
  
      function CheckLoaded()
      {
        if (swfFile)
        {
          //alert("CheckLoaded " + swfFile.PercentLoaded() );
          //if (swfFile.PercentLoaded() == 100)//Does not work sometimes         
          {
            //Stop startup timer
            clearInterval(loadCheckIntervalId);
            //Get the total number of frames
            totalFrames = swfFile.TGetProperty("/", 5);
            document.getElementById("totalFramesLabel").innerHTML = totalFrames;
                 
            if (frameSlider)
            {
              frameSlider.setMaximum(totalFrames-1);
              frameSlider.setMinimum(0);
              frameSlider.setUnitIncrement(1);
            }
            //Set timer to update current frame
            intervalId = setInterval(UpdateCurrentFrame, 250);
          }
        }
        else
        {
          //Setup swfFile when movie is loaded
          swfFile =  swfobject.getObjectById("myFlashContent");
        }
      }
      
      function Play() {
 
        if (swfFile)
        {
          if (swfFile.IsPlaying())
          {
            //Remove the timer
            clearInterval(intervalId);
            _priv_stop();
            UpdateCurrentFrame(false);
          }
          else
          {
            _priv_play();
            //Set timer to update current frame
            intervalId = setInterval(UpdateCurrentFrame, 250);
          }           
        }
      }
      function Next() {
 
        if (swfFile)
        {
          var currentFrame=swfFile.TGetProperty("/", 4);
          var nextFrame=parseInt(currentFrame);
          swfFile.GotoFrame(nextFrame);
          UpdateCurrentFrame(false);
        }
      } 
      function Previous() {
 
        if (swfFile)
        {
          var currentFrame=swfFile.TGetProperty("/", 4);
          var prevFrame=parseInt(currentFrame) - 2;
          swfFile.GotoFrame(prevFrame);
          UpdateCurrentFrame(false);
        }
      } 
      function Last() {
 
        if (swfFile)
        {
          var lastFrame = parseInt(swfFile.TGetProperty("/", 5));
          swfFile.GotoFrame(lastFrame);
          UpdateCurrentFrame(false)
        }
      } 
      function First() {
 
        if (swfFile)
        {
          swfFile.GotoFrame(0);
          UpdateCurrentFrame(false);
        }
      } 
      function ToggleLoop() {
      
        isLooping = !isLooping;
 
        document.images[ "loopImg" ].src = isLooping ? "img/loop_on.png" : "img/loop_off.png";
        UpdateCurrentFrame(false);
        
      }
 
      function _priv_stop()
      {
        isPlaying = false;
        swfFile.StopPlay();
        document.images[ "PlayPauseImg" ].src = "img/play_on.png";
      }
      function _priv_play()
      {
        swfFile.Play();
        isPlaying = true;
        document.images[ "PlayPauseImg" ].src = "img/stop_on.png";
      }
      function UpdateCurrentFrame(bBlockSliderUpdate){
 
        if (swfFile)
        {
          var currentFrame=swfFile.TGetProperty("/", 4);
          document.getElementById("currentFrameLabel").innerHTML = currentFrame;
          
          if (frameSlider /*&& bBlockSliderUpdate == false*/)
          {
            blockSliderEvents = true;
            frameSlider.setValue(currentFrame-1);
            blockSliderEvents = false;
          }
          if (isLooping == false)
          {
            //Movie ended normally
            if (swfFile.IsPlaying() == false)
            {
              clearInterval(intervalId);
              _priv_stop();
            }
          }
          else
          {
            //Movie at end loop back at the beginning 
            if (currentFrame > (swfFile.TGetProperty("/", 5)-1) && isPlaying)
            {
              swfFile.GotoFrame(0);
              _priv_play();
            }
          }
        }    
        else
        {
          document.getElementById("currentFrame").innerHTML = "Loading";
        }
      }
      
      function SliderValueChanged(){    
        if (swfFile && frameSlider && blockSliderEvents == false && isPlaying == false)
        {
          var frame = frameSlider.getValue();
          if (swfFile.IsPlaying())
          {
            _priv_stop();
          }
          swfFile.GotoFrame(frame);
          UpdateCurrentFrame(true);
        }
      }
   
      //Register swof object
                        swfobject.registerObject("myFlashContent", "9.0.0");
      //Set a timer to make sure that the movie is fully loaded
      window.onload = function() {
        loadCheckIntervalId = setInterval(CheckLoaded, 250);      
      }
 
                </script>
 
    <link type="text/css" rel="StyleSheet" href="css/blackslider/blackslider.css" />
    <link type="text/css" rel="StyleSheet" href="css/blackplayer/blackplayer.css" />
 
    <style type="text/css">
    #slider-1 {
        margin: 10px;
        width750px;
    }   
    </style>
	</head>
	<body>
  <br>
  <center>
 
  <table align="center" border="0" cellpadding="0" cellspacing="0" width="812">
    <tr class="top-black">
    <td colspan="3" align="center">
		<div>
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="750" height="600" id="myFlashContent">
				<param name="movie" value="../movie.swf" />
				<param name="loop" value="false" />
				<!--[if !IE]>-->
				<object type="application/x-shockwave-flash" data="../movie.swf" width="750" height="600">
          <param name="allowScriptAccess" value="sameDomain"/>
          <param name="loop" value="false" />
				<!--<![endif]-->
					<a href="http://www.adobe.com/go/getflashplayer">Get Flash Player
						<!--<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />-->
					</a>
				<!--[if !IE]>-->
				</object>
				<!--<![endif]-->
			</object>
		</div>
    </td>
 
    </tr>
 
    <tr class="middle-black">
    <td colspan="3" align="center">
      <form onsubmit="return false;">
        <div class="slider" id="slider-1" tabIndex="1">
          <input class="slider-input" id="slider-input-1"/>
        </div>
      </form>
      <script type="text/javascript"> 
      //Register slider
      var sliderEl = document.getElementById ? document.getElementById("slider-1") : null;
      var inputEl = document.forms[0]["slider-input-1"];
      frameSlider = new Slider(sliderEl, inputEl);
      frameSlider.onchange = SliderValueChanged;
 
      window.onresize = function () {
        frameSlider.recalculate();
      };
      </script>
    </td>
    </tr>
 
    <tr class="bottom-black">
    <td>
      <table border="0" style="width:100%">
      <tr>
        <td style="padding-left:10px">
          <a href="javascript:void(0);" onclick="location.reload();"><img src="img/refresh.png" border="0" ></a> 
        </td>
        <td align="center">
          <a href="javascript:void(0);" onclick="First();" >
          <img name="firstImg" src="img/goto_first_on.png" border="0" ></a> 
          <a href="javascript:void(0);" onclick="Previous();">
          <img name="PrevImg" src="img/prev_frame_on.png" border="0" ></a> 
          <a href="javascript:void(0);" onclick="Play();">
          <img name="PlayPauseImg" src="img/stop_on.png" border="0" ></a> 
          <a href="javascript:void(0);" onclick="Next();">
          <img name="nextImg" src="img/next_frame_on.png" border="0" ></a> 
          <a href="javascript:void(0);" onclick="Last();">
          <img name="lastImg" src="img/goto_last_on.png" border="0" ></a> 
          <a href="javascript:void(0);" onclick="ToggleLoop();" id="loopToggleButton">
          <img name="loopImg" src="img/loop_off.png" border="0" >
          </a> 
        </td>
          <td align="right" width="100" class="frame-counter-black-player">
          <span id="currentFrameLabel">1</span> / <span id="totalFramesLabel">1</span>
        </td>
      </tr>
      </table>
    </td>
    </tr>    
 
  </table>
  </center>
 
	</body>
</html>

La video (ici movie.swf) est situee dans le repertoire au dessus accompagnee d'un fichier movie.html dont le contenue est le suivant :

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<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" />
<title>movie</title>
<style type="text/css">
 
</style>
</head>
<body bgcolor="#ffffff">
   <table border='0' cellpadding='0' align="left">
      <tr><td>
         <hr align="left" color="#666666"><br>
      </td></tr>
      <tr><td>
         <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  width="640" height="480" id="movie.swf " align="middle">
             <param name="allowScriptAccess" value="sameDomain" />
             <param name="movie" value="movie.swf" />
             <param name="quality" value="high" />
             <param name="bgcolor" value="#ffffff" />
          <embed src="movie.swf" quality="high" bgcolor="#ffffff"
                 width="640" height="480" name="movie.swf" align="middle"
                 allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
                 pluginspage="http://www.macromedia.com/go/getflashplayer" />
          </embed>
         </object>
      </td></tr>
      <tr><td>
         <br><hr align="left" color="#666666">
      </td></tr>
      <tr><td>
         <br><p class="style1 style2">Generated by <a href="http://www.toonboom.com/">Toon Boom Studio</a></p>
      </td></tr>
   </table>
</body>
</html>

Le swfobject.js ainsi que d'autres fichiers javascript sont stockes dans un autre dossier.

Jusqu'a recemment tout marchait tres bien et depuis une update recente de flash player certains boutons ne fonctionnent plus, notamment Next. Quand je regarde le log je vois que l'appel de swfFile.GotoFrame() echoue et j'obtiens le message suivant : "Error calling method on NPObject!". Je suis alle sur de nombreux forums ou d'autres personnes ont le meme probleme que moi et certains disent qu'il s'agirait d'un probleme de securite. J'ai essaye de mettre "allowScriptAccess" a "always" comme ils le preconisent mais ca ne change rien. Je re-precise que je ne suis pas developpeur web alors essayez d'y aller lentement si vous avez des explications techniques a me donner