supernginx / flowplayer-core

Automatically exported from code.google.com/p/flowplayer-core
0 stars 0 forks source link

onIoError followed by 301: Unable to load plugin #572

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am using cuepoints combined with seek. The idea is to launch a video and have 
it pause to present a question or questions on a given cuepoint.
I also am simply playing videos. I use two separate function calls to either 
play video with questions or just play video. If the user has not finished a 
video, a decision alert is presented to continue from last point or start at 
the beginning. 

the errors are unpredictable. I cannot reproduce them by following a set of 
steps. They happen when they happen. Below is the errors:

[ERROR] time 18:12:40.439 :: org.flowplayer.view::PluginLoader : onIoError 
/scripts/flowplayer/flowplayer.controls-3.2.8.swf
[ERROR] time 18:12:40.448 :: 301: Unable to load plugin: unable to load plugin 
'controls', url: '/scripts/flowplayer/flowplayer.controls-3.2.8.swf'
[ERROR] time 18:12:40.477 :: 301: Unable to load plugin: Unable to load plugin, 
url /scripts/flowplayer/flowplayer.controls-3.2.8.swf, name controls
[ERROR] time 18:12:40.505 :: 301: Unable to load plugin: Unable to load plugin, 
url /scripts/flowplayer/flowplayer.controls-3.2.8.swf, name controls

Here are the two functions:

var seekTime = 0;
var tmpSeek = 0;
var timeCompleted = 0;
var videoRefreshFlag = false;
var autoBufferControl = true;
var autoPlayControl = true;
var player;

function runVideo(itemId, parentList, learningAssignmentId, video, pifId, 
status, saleItemId,
                  bucket, domain, divToPlay, refreshFlag)
{
  var relativeURL = "/lms/runItem";
  var videoUrl = "";

  var params = "itemId=" + itemId + "&parentList=" + parentList+ "&saleItemId=" + saleItemId + "&action=video";
  if (learningAssignmentId != '')
      params+="&learningAssignmentId="+learningAssignmentId;

  var async = true;

  // Remember which page to return to.
  if (location.href.lastIndexOf("login") > -1 || location.href.lastIndexOf("availableCourses") > -1)
  {
      relativeURL += "&returnPage=available";
  }
  else if (location.href.lastIndexOf("courseHistory") > -1)
  {
      relativeURL += "&returnPage=history";
  }
  else {
      relativeURL += "&returnPage=";
  }

  var response = makeGenericHTTPRequest(relativeURL, params, async);

  if(navigator.userAgent.match(/iPhone/i)
     || navigator.userAgent.match(/iPad/i)
     || navigator.userAgent.match(/iPod/i))
  {
    videoUrl =  "http://s3.amazonaws.com/" + bucket + "/" + domain + "/" + pifId + "/" + video;
    autoBufferControl = false;
    autoPlayControl = false;
    //alert("MobileURL: " + videoUrl);
  }
  else
  {
    videoUrl =  "/lms/content/" + pifId + "/" + video;
    //alert("MachineURL: " + videoUrl);
  }

  var scormAPI = null;
  var mStart = 0;
  timeCompleted = 0;
  var $effect = "";
  videoRefreshFlag = refreshFlag;

  //set bools for controls
  var timeControl = true;
  var volControl = true;
  var fullControl = false;
  var scrubControl = true;

  var docHeight = $(document).height();
  var docWidth = $(document).width();

  if(status != "completed")
  {
    scrubControl = false;
  }
  SCORM2004Initialize("");
  var seekTimeStr = LMSGetValue("cmi.suspend_data");
  if(seekTimeStr != "null" && seekTimeStr != "completed")
  {
    tmpSeek = parseInt(seekTimeStr);
    if(!isNaN(tmpSeek) && tmpSeek > 0)
    {
      var answer = confirm ("Would you like to resume from where you left off?");
      if (answer)
      {
        seekTime = tmpSeek;
      }
    }
  }
  //console.log("Seek Time String: " + seekTimeStr + " Seek Time: " + seekTime);

  player = $f(divToPlay, "/scripts/flowplayer/flowplayer-3.2.8.swf", {
       plugins: {
           controls: {
             url: "/scripts/flowplayer/flowplayer.controls-3.2.8.swf",
                    scrubber: scrubControl,
                      time: true,
                      pause: true,
                      volume: true,
                      fullscreen: true
           }
         },
    clip: {
          url: videoUrl,
          autoPlay: autoPlayControl,
          autoBuffering: autoBufferControl,
          scaling: 'fit'
     },
      onFinish: function() {
        var now = new Date().getTime();
        LMSSetValue("cmi.core.session_time", millisToCMITimespan((now - mStart) + timeCompleted));
        LMSSetValue("cmi.core.lesson_status","completed");
        LMSCommit("");
        LMSFinish("");
      },
      onPause: function() {
        var now = new Date().getTime();
        seekTime = $f().getTime();
        LMSSetValue("cmi.suspend_data",seekTime);
        LMSSetValue("cmi.core.session_time", millisToCMITimespan((now - mStart) + timeCompleted));
        LMSCommit("");
      },
      onStart: function() {
        if(seekTime > 0)
        {
          player.pause();
          player.seek(seekTime);
          player.resume();
        }
        mStart = new Date().getTime();
      },
      onResume: function() {
        timeCompleted = timeCompleted + mStart;
        mStart = new Date().getTime();
      }
  }).ipad();
}

//first code attempt for video with assessment
function runVideoAssessment(itemId, parentList, learningAssignmentId, video, 
pifId, status, saleItemId,
                  bucket, quizInstructions, domain, cuepointsTxt, refreshFlag)
{
  var relativeURL = "/lms/runItem";
  var videoUrl = "";
  var divToPlay = "div.assessment" + pifId;
  var params = "itemId=" + itemId + "&parentList=" + parentList+ "&saleItemId=" + saleItemId + "&action=video";
  if (learningAssignmentId != '')
      params+="&learningAssignmentId="+learningAssignmentId;

  var async = true;

  // Remember which page to return to.
  if (location.href.lastIndexOf("login") > -1 || location.href.lastIndexOf("availableCourses") > -1)
  {
      relativeURL += "&returnPage=available";
  }
  else if (location.href.lastIndexOf("courseHistory") > -1)
  {
      relativeURL += "&returnPage=history";
  }
  else {
      relativeURL += "&returnPage=";
  }

  var response = makeGenericHTTPRequest(relativeURL, params, async);

  if(navigator.userAgent.match(/iPhone/i)
     || navigator.userAgent.match(/iPad/i)
     || navigator.userAgent.match(/iPod/i))
  {
    videoUrl =  "http://s3.amazonaws.com/" + bucket + "/" + domain + "/" + pifId + "/" + video;
    autoBufferControl = false;
    autoPlayControl = false;
    //alert("MobileURL: " + videoUrl);
  }
  else
  {
    videoUrl =  "/lms/content/" + pifId + "/" + video;
    //alert("MachineURL: " + videoUrl);
  }

  var scormAPI = null;
  var mStart = 0;
  timeCompleted = 0;
  var $effect = "";
  var accessible = false;
  videoRefreshFlag = refreshFlag;

  //set bools for controls
  var timeControl = true;
  var volControl = true;
  var fullControl = false;
  var scrubControl = true;
  var questionPause = false;

  if(status != "passed")
  {
    scrubControl = false;
  }

  var tmpStuff = cuepointsTxt.split(".");

  var cuepoints = [];
  var questions = [];
  var questionsForCuepoint = [];
  var htmlStr = "";
  var currentQuestion = 0;

  var i = 0;
  for (i = 0; i <= tmpStuff.length; i++)
  {
     var nodeStr = tmpStuff[i];
     if(nodeStr != null && nodeStr != "")
     {
      var node = nodeStr.split(":");
      cuepoints[i] = parseInt(node[1]) * 1000;
     }
  }
  SCORM2004Initialize("");
  var seekTimeStr = LMSGetValue("cmi.suspend_data");
  if(seekTimeStr != "null" && seekTimeStr != "completed")
  {
    tmpSeek = parseInt(seekTimeStr);
    if(!isNaN(tmpSeek) && tmpSeek > 0)
    {
      var answer = confirm ("Would you like to resume from where you left off?");
      if (answer)
      {
        seekTime = tmpSeek;
      }
    }
  }
  //console.log("Seek Time String: " + seekTimeStr + " Seek Time: " + seekTime);
  cuepoints = sortAndRemoveDuplicateCues(cuepoints, seekTime);
  if(cuepoints.length == 0)
    cuepoints[0] = 36000000;
  console.log(cuepoints);

  for (i = 0; i <= cuepoints.length; i++)
  {
    var questionsForCuepoint = [];
    var index = 0;
    for (j = 0; j <= tmpStuff.length; j++)
    {
      if(tmpStuff[j] != null && tmpStuff[j] != "")
      {
        var tmp = tmpStuff[j].split(":");
        if((parseInt(tmp[1]) * 1000) == cuepoints[i])
        {
          //Create new sub-array
          //Add question(s) to the array
          //set the array to the questions array
          questionsForCuepoint[index] = parseInt( tmp[0]);
          index = index + 1;
        }
      }
    }
    questions[i] = new Array(questionsForCuepoint.length);
    questions[i] = questionsForCuepoint;
  }

  i = 0;
    player = $f('divorelassess', "/scripts/flowplayer/flowplayer-3.2.8.swf", {
        plugins: {
          controls: {
            url: "/scripts/flowplayer/flowplayer.controls-3.2.8.swf",
             scrubber: scrubControl,
             time: true,
             pause: true,
             volume: true,
             fullscreen: true
          }
        },
    clip: {
      url: videoUrl,
      autoPlay: autoPlayControl,
      autoBuffering: autoBufferControl,
      scaling: 'fit',
    },
    playlist: [
      {
       onCuepoint: [
         cuepoints,

           function(clip, cuepoint) {
               console.log("cuepoint", cuepoint);
               if(cuepoint == cuepoints[i])
               {
                 questionsForCuepoint = questions[i];
                 questionPause = true;
                 $f().pause();
               }
             }
           ]
      }
    ],
    onStart: function() {
      //console.log($f().getClip().cuepoints);
      //if($f().getClip().cuepoints.length == 0)
      //  player.onCuepoint(cuepoints, function(clip) {});
      if(seekTime > 0)
      {
        player.pause();
        player.seek(seekTime);
        player.resume();
      }
      mStart = new Date().getTime();
    },
    onPause: function() {
      if(questionPause)
      {
        i = i + 1;
        if(questionsForCuepoint != null)
        {
          var cuepointStr = "";
          for(cue = 0; cue < questionsForCuepoint.length; cue++)
          {
            cuepointStr = cuepointStr + questionsForCuepoint[cue] + ":";
          }
        }
        //remove the ending colon
        cuepointStr = cuepointStr.substring(0,cuepointStr.length - 1);
        runCuepointQuestions(cuepointStr, divToPlay);
      }
      else
      {
        var now = new Date().getTime();
        seekTime = $f().getTime();
        LMSSetValue("cmi.suspend_data",Math.floor(seekTime));
        LMSSetValue("cmi.core.session_time", millisToCMITimespan((now - mStart) + timeCompleted));
        LMSCommit("");
      }
    },
    onFinish: function() {
      var now = new Date().getTime();
      LMSSetValue("cmi.core.session_time", millisToCMITimespan((now - mStart) + timeCompleted));
      LMSSetValue("cmi.suspend_data","completed");
      LMSFinish("");
      LMSCommit("");
    },
    onResume: function() {
     timeCompleted = timeCompleted + mStart;
     mStart = new Date().getTime();
     if((i < cuepoints.length) && questionPause)
     {
      questionPause = false;
      $('div.assessment').html('<p>' + quizInstructions + '<p>');
     }
     else if(questionPause)
     {
      questionPause = false;
      $('div.assessment').html('<p>' + quizInstructions + '<p>');
     }
    }
  }).ipad();
}

I run flowplayer on an overlay. The code is here:

 <script language="javascript">
      $(document).ready(function (content) {
      $("a[rel]").overlay({
      effect: 'apple',
      expose: '#111',
      load: true,
      onLoad: function() {
      $f().load();
      },
      onBeforeClose: function() {
      seekTime = $f().getTime();
      var now = new Date().getTime();
      LMSSetValue("cmi.suspend_data",Math.floor(seekTime));
      LMSCommit("");
      LMSSetValue("cmi.core.session_time", millisToCMITimespan((now - mStart) + timeCompleted));
      //alert("seekTime: " + seekTime + " now: " + now + "and mStart: " + mStart + " and timeCompleted: " + timeCompleted);
      },
      onClose: function() {
      player.unload();
      checkItemBrowserClosed();
      }
      });
      });
    </script>

Has anyone seen something similar to this?

Original issue reported on code.google.com by aaron.fr...@gmail.com on 24 May 2012 at 11:20

GoogleCodeExporter commented 8 years ago
Please note that there ajax calls intermixed with the flowplayer javascript.

Original comment by aaron.fr...@gmail.com on 24 May 2012 at 11:20

GoogleCodeExporter commented 8 years ago
this is unreadable im afraid are you able to provide a demo page if possible. 

Original comment by dani...@electroteque.org on 25 May 2012 at 8:45

GoogleCodeExporter commented 8 years ago
Okay, I am getting the following when I run video, whether I have cuepoints or 
not:

$f.fireEvent ["onBeforeLoad"]
flowpl....2.8.js (line 44)
$f.fireEvent ["onBeforeLoad"]
flowpl....2.8.js (line 44)
[LOG] time 00:35:34.857 :: org.flowplayer.view::Launcher : got loader
/lms/a...ourses/
[LOG] time 00:35:34.861 :: org.flowplayer.view::Launcher : setting root style 
to [object Launcher]
/lms/a...ourses/
[LOG] time 00:35:34.864 :: org.flowplayer.view::Launcher : background color is 
transparent
/lms/a...ourses/
[LOG] time 00:35:34.866 :: org.flowplayer.view::Launcher : adding gradient
/lms/a...ourses/
[LOG] time 00:35:34.869 :: org.flowplayer.view::Launcher : background color is 
transparent
/lms/a...ourses/
[LOG] time 00:35:34.871 :: org.flowplayer.view::Launcher : adding gradient
/lms/a...ourses/
[LOG] time 00:35:34.872 :: org.flowplayer.view::Launcher : Adding logo to canvas
/lms/a...ourses/
[LOG] time 00:35:34.876 :: org.flowplayer.view::Launcher : adding logo to 
display list
/lms/a...ourses/
[LOG] time 00:35:34.877 :: org.flowplayer.view::Launcher : background color is 
transparent
/lms/a...ourses/
[LOG] time 00:35:34.879 :: org.flowplayer.view::Launcher : adding gradient
/lms/a...ourses/
[LOG] time 00:35:34.880 :: org.flowplayer.view::Launcher : security sandbox 
type: remote
/lms/a...ourses/
[INFO] time 00:35:34.882 :: org.flowplayer.view::Launcher : Flowplayer free 
version 3.2.8
/lms/a...ourses/
[LOG] time 00:35:34.883 :: org.flowplayer.view::Launcher : creating Panel
/lms/a...ourses/
[LOG] time 00:35:34.885 :: org.flowplayer.view::Launcher : Creating animation 
engine
/lms/a...ourses/
[LOG] time 00:35:34.888 :: org.flowplayer.view::Launcher : creating play button 
overlay
/lms/a...ourses/
[LOG] time 00:35:34.898 :: org.flowplayer.view::Launcher : creating Flowplayer 
API
/lms/a...ourses/
[INFO] time 00:35:34.900 :: org.flowplayer.view::Launcher : initPhase2
/lms/a...ourses/
[LOG] time 00:35:34.914 :: org.flowplayer.view::Launcher : will load following 
plugins:
/lms/a...ourses/
[INFO] time 00:35:34.916 :: org.flowplayer.view::Launcher : [Loadable] 
'controls', builtIn false
/lms/a...ourses/
[LOG] time 00:35:34.917 :: org.flowplayer.view::Launcher : useExternalInteface: 
true
/lms/a...ourses/
$f.fireEvent ["onError", 100, ": null"]
flowpl....2.8.js (line 44)
$f.fireEvent ["onError", 301, ": unable to load 
plugin...yer.controls-3.2.8.swf'"]
flowpl....2.8.js (line 44)
[ERROR] time 00:35:34.927 :: 301: Unable to load plugin: unable to load plugin 
'controls', url: '/scripts/flowplayer/flowplayer.controls-3.2.8.swf'
[LOG] time 00:35:34.931 :: org.flowplayer.view::Launcher : initPhase3, all 
plugins loaded
/lms/a...ourses/
[LOG] time 00:35:34.938 :: org.flowplayer.view::Launcher : creating 
PlayListController
/lms/a...ourses/
[LOG] time 00:35:34.940 :: org.flowplayer.view::Launcher : creating provider 
with name http
/lms/a...ourses/
[LOG] time 00:35:34.942 :: org.flowplayer.view::Launcher : creating provider 
with name httpInstream
/lms/a...ourses/
[LOG] time 00:35:34.952 :: org.flowplayer.view::Launcher : useExternalInteface: 
true
/lms/a...ourses/
[LOG] time 00:35:34.953 :: org.flowplayer.view::Launcher : creating logo

Notice error 100 but the text is null. I have no idea how to fix this. The 
error is random. I have been able to detect a pattern for its appearance. 

Original comment by aaron.fr...@gmail.com on 29 May 2012 at 2:29

GoogleCodeExporter commented 8 years ago
This error causes cuepoints not to load. It happens with both functions, but I 
need cuepoints to run.

Original comment by aaron.fr...@gmail.com on 29 May 2012 at 2:30

GoogleCodeExporter commented 8 years ago
Please provide an example online. Im pretty sure you posted this in the forums 
correct ? 

$f.fireEvent ["onError", 301, ": unable to load 
plugin...yer.controls-3.2.8.swf'"]

it can't load the controls plugin it seems. 

Original comment by electrot...@gmail.com on 1 Jun 2012 at 6:05

GoogleCodeExporter commented 8 years ago

Original comment by dani...@electroteque.org on 1 Jun 2012 at 8:51

GoogleCodeExporter commented 8 years ago
Is this still happening if you load the controls correctly

Original comment by dani...@electroteque.org on 2 Jun 2012 at 8:00

GoogleCodeExporter commented 8 years ago
Hi Im going to close this , I have not been given an example page please update 
if needed, it looks to me you aren't loading the controls correctly. 

Original comment by dani...@electroteque.org on 4 Jun 2012 at 8:44