Script is causing the Flash player to run slowly error msg

  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 463

Post 3+ Months Ago

Hi to start out I am a good coder and have helped people on this forum before I am looking to see if anyone has any ideas on my issue I’m having.

The issue is I have made a simple video player with no controls and for the purpose of repeating video/videos indefinitely in full screen. (This is used on a TV for advertising and training purposes.) It will run for a few days and then stop and in a few cases it popped up the "The script is causing the Flash player to run slowly, this may cause your computer to stop responding, do you want to abort the script?" message. BEFORE anyone says anything about that message I cannot find any infinite loops in the code. The code is very simplistic. Any thoughts?

The flash movie is a black background with an FLVPlayback component on the stage.

Sample XML:
XML Code: [ Select ]
<?xml version="1.0" encoding="utf-8"?>
<videos>
   <video url="video1.flv"></video>
   <video url="video2.flv"></video>
</videos>
 
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <videos>
  3.    <video url="video1.flv"></video>
  4.    <video url="video2.flv"></video>
  5. </videos>
  6.  


Action Script:
ACTIONSCRIPT Code: [ Select ]
/***************| Initialization |***************/
 
// This indecates which video we are on it represents the first index in the video array
var on_video:Number = 0;
 
// This varible will trigger the screen to be in full screen mode
var fullscreen:Boolean = false;
 
// Make an array to hold onto the videos
var videos = Array();
 
// Make a new XML object
var video_xml:XML = new XML();
 
// Igonre white space in the xml file
video_xml.ignoreWhite = true;
 
// What to do when the XML loads
video_xml.onLoad = function(success:Boolean){
   
   // Check to see if the xml loaded correctly
   if (success) {
     
      // Grab all of the tracks and attributes
      var nodes:Array = this.firstChild.childNodes;
     
      // Loop through the node and add all of there attributes into the array
      for(var i=0;i<nodes.length;i++)  {
         trace(i + ' = ' + nodes[i].attributes.url)
         // Add all of the other information needed
         videos.push(nodes[i].attributes.url);
         
      }
     
      // Start to play the videos
      play_video();
   
   }
   
}
 
// Lets get the XML file
video_xml.load('http://mysite/getxml.php?ids=' + _root.playlist);
 
 
/***************| Playing Functionallity |***************/
 
// Play the video File
function play_video(){  
   
   // Set the video window to play the the video file as an flv
   myplayer.contentPath = videos[on_video];
   
   // Set the video size
   myplayer.setSize(Stage.width,Stage.height);
   
   // Reset the plery position
   myplayer.playheadTime = 0;
   
   // Play the video
   myplayer.play();
   
}
 
// This will increment the on video varible or reset it once it hits the end
function next_video() {
   
   // Add one to the on video varible or set back to zero if we are on the last video
   on_video = (on_video == videos.length-1) ? 0 : on_video + 1;
   trace(on_video)
   // play the video
   play_video();
   
}
 
 
/***************| General Functionallity |***************/
 
// Start an on enter frame event to do therest of the functionality
this.onEnterFrame = function(){
   
   // Calculate the percentage
   perc_complete = Math.round((myplayer.playheadTime / myplayer.totalTime) * 100);
   
   // Check to see if we are past zero and at 100 percent
   if(myplayer.totalTime > 0 && perc_complete >= 95) {
     
      // Play the next video
      next_video();
     
   }
   
   //trace(perc_complete)
   
}
 
// This will toggle the fullscreen flag
myplayer.onRelease = function() {
   
   // Check and set the flag
   fullscreen = (fullscreen) ? false : true;
   
   // Check to see if we are not in full screen and the fullscreen flag is true
   if(Stage.displayState == "normal") {
     
      // Launch fullscreen mode
      Stage.displayState = "fullScreen";
     
   } else {
     
      // return to the normal mode
      Stage.displayState = "normal";
     
   }
   
}
 
  1. /***************| Initialization |***************/
  2.  
  3. // This indecates which video we are on it represents the first index in the video array
  4. var on_video:Number = 0;
  5.  
  6. // This varible will trigger the screen to be in full screen mode
  7. var fullscreen:Boolean = false;
  8.  
  9. // Make an array to hold onto the videos
  10. var videos = Array();
  11.  
  12. // Make a new XML object
  13. var video_xml:XML = new XML();
  14.  
  15. // Igonre white space in the xml file
  16. video_xml.ignoreWhite = true;
  17.  
  18. // What to do when the XML loads
  19. video_xml.onLoad = function(success:Boolean){
  20.    
  21.    // Check to see if the xml loaded correctly
  22.    if (success) {
  23.      
  24.       // Grab all of the tracks and attributes
  25.       var nodes:Array = this.firstChild.childNodes;
  26.      
  27.       // Loop through the node and add all of there attributes into the array
  28.       for(var i=0;i<nodes.length;i++)  {
  29.          trace(i + ' = ' + nodes[i].attributes.url)
  30.          // Add all of the other information needed
  31.          videos.push(nodes[i].attributes.url);
  32.          
  33.       }
  34.      
  35.       // Start to play the videos
  36.       play_video();
  37.    
  38.    }
  39.    
  40. }
  41.  
  42. // Lets get the XML file
  43. video_xml.load('http://mysite/getxml.php?ids=' + _root.playlist);
  44.  
  45.  
  46. /***************| Playing Functionallity |***************/
  47.  
  48. // Play the video File
  49. function play_video(){  
  50.    
  51.    // Set the video window to play the the video file as an flv
  52.    myplayer.contentPath = videos[on_video];
  53.    
  54.    // Set the video size
  55.    myplayer.setSize(Stage.width,Stage.height);
  56.    
  57.    // Reset the plery position
  58.    myplayer.playheadTime = 0;
  59.    
  60.    // Play the video
  61.    myplayer.play();
  62.    
  63. }
  64.  
  65. // This will increment the on video varible or reset it once it hits the end
  66. function next_video() {
  67.    
  68.    // Add one to the on video varible or set back to zero if we are on the last video
  69.    on_video = (on_video == videos.length-1) ? 0 : on_video + 1;
  70.    trace(on_video)
  71.    // play the video
  72.    play_video();
  73.    
  74. }
  75.  
  76.  
  77. /***************| General Functionallity |***************/
  78.  
  79. // Start an on enter frame event to do therest of the functionality
  80. this.onEnterFrame = function(){
  81.    
  82.    // Calculate the percentage
  83.    perc_complete = Math.round((myplayer.playheadTime / myplayer.totalTime) * 100);
  84.    
  85.    // Check to see if we are past zero and at 100 percent
  86.    if(myplayer.totalTime > 0 && perc_complete >= 95) {
  87.      
  88.       // Play the next video
  89.       next_video();
  90.      
  91.    }
  92.    
  93.    //trace(perc_complete)
  94.    
  95. }
  96.  
  97. // This will toggle the fullscreen flag
  98. myplayer.onRelease = function() {
  99.    
  100.    // Check and set the flag
  101.    fullscreen = (fullscreen) ? false : true;
  102.    
  103.    // Check to see if we are not in full screen and the fullscreen flag is true
  104.    if(Stage.displayState == "normal") {
  105.      
  106.       // Launch fullscreen mode
  107.       Stage.displayState = "fullScreen";
  108.      
  109.    } else {
  110.      
  111.       // return to the normal mode
  112.       Stage.displayState = "normal";
  113.      
  114.    }
  115.    
  116. }
  117.  
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I'm inclined to doubt that it's even your code that's at fault (nor do I see a problem with an endless loop there). Curious what version of Flash Player you are using. There are a TON of complaints about Flash Player 10 utilizing 100% CPU (and a lot of memory / swap file). Flash Player is constantly crashing Firefox for me when I watch a lot of FLV videos, like from Youtube for example. And I get the same error.

Here's a list of the minimum system requirements that you might find usefull.
http://www.adobe.com/products/flashplayer/systemreqs/

Also notice one of the notes on that page:
Quote:
Recommended for GPU hardware acceleration–dependent features. Flash Player will use software mode for systems that do not meet the system requirements.


If it goes to software mode, it's going to use a lot more CPU than it would with supported graphics hardware.
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 463

Post 3+ Months Ago

Thank you for your quick reply. I will look into the system requirements.

Quote:
There are a TON of complaints about Flash Player 10 utilizing 100% CPU (and a lot of memory / swap file).


This is helpful I am running flash player 10.

Side Note:
Until I fix this issue I am still open to thoughts on the issue.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Speaking of Crashes, guess what just crashed? Give that man a cigar! Just watching a video in firefox and once again the flash plugin crashed.

http://support.mozilla.com/en-US/kb/Plu ... ports?as=u

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 17 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.