this.rs

Workarounds and usability notes.

this.rs

Postby John Robin Dove » Sun Nov 15, 2020 8:03 am

Hi Cliffton,

Strange error message: this.rs is undefined I have no variable or object called rs. It seems to be semi-random but appears more frequently when I use htmlVideoControl playBetween. Any thoughts please?

John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby Clifton » Sun Nov 15, 2020 10:09 am

The error you report is related to the playBetween method of the htmlVideoControl() function.

Can you provide a sequence of calls that demonstrate the problem, even if only occasionally?

NOTE: Usually, if you call htmlVideoLoader() and immediately on the next line call htmlVideoControl() with the playBetween method, an error like this could be triggered. Likely reason is that the rangeSlider.js file is not fully parsed at the moment htmlVideoControl() is attempting to call the playBetween method. I would like to resolve this because while setting a delay between the two functions may usually work, it is not the preferred solution.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: this.rs

Postby John Robin Dove » Sun Nov 15, 2020 11:56 am

I have changed so many things around so much that at the moment I can't reproduce the error. I understand that you are keen to resolve this and I'll look into it again tomorrow. I'm a bit tired of the whole thing at the moment. :cry: It's been a bad day.

I started with an incomprehensible self-inflicted problem. I had two objects called 'load1' and 'load2'. I didn't need both so I deleted one and renamed the other one 'load'. That was a bad move. Thereafter the video player refused to start. I convinced myself that the problem was caused by my conincidental deleting of Flash player this morning or some other changes I had made and I forgot about the name change. Several hours later I remembered it and so discovered that you must not name an object 'load'. Could you perhaps provide a list of unusable names? I have seen one or two. Those I can remember are load, class, and b + a number.

Next came the this.rs message.

Lastly I have spent hours trying to figure out why the video player kept malfunctioning. This was not with a YouTube video but one uploaded to my server. The symptoms were freezing immediately after starting and absence of sound. I discovered that the problem could be cured by setting autoplay to true. My code was tbfunction_htmlVideoLoader("screen", false, false, "", "continuous", "", "", "", "", fileName) which I have replaced with tbfunction_htmlVideoLoader("screen", false, true, "", "continuous", "", "", "", "", fileName)

So I'll call it a day and be in touch tomorrow.
John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby Clifton » Sun Nov 15, 2020 1:18 pm

class is a JavaScript reserved keyword.

Also avoid b# and p# and k# as these will mess with how ToolBook assigns ids during export.

Object names that will also correspond to XML tags should follow these naming conventions:
  • To refer to the current page in a tag, you can use <[pageName]> or just the tag <page>.
  • To refer to the current background in a tag, you can use <[backgroundName]> or just the tag <background>.
  • Element names cannot contain spaces.
  • Element names are case-sensitive.
  • Element names must start with a letter or underscore.
  • Element names cannot start with the letters xml (or XML, or Xml, etc)
  • Element names can contain letters, digits, hyphens, underscores, and periods.
  • Element names cannot contain spaces. generally must always begin with a
When in doubt, use a prefix that is unique to your project, like "my" or an "_" or some other prefix. Or use a word that ends in a number, etc.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: this.rs

Postby John Robin Dove » Mon Nov 16, 2020 7:03 am

Hi Clifton,
Thanks for the list. In my ongoing project the error message showed up only once the first time I tested the program on XAMPP. I was going to send (complicated) parts of this program but then I discovered that I could produce the error consistently on a small test app. It was originally made to see whether it's possible to start a youTube video from a play button. It is possible in Firefox, Edge and IE but not in Chrome. So test it with Firefox. This is what I see every time when I run it in your Web server system.
Image

I have put a zip here http://www.mediacours.com/tb_examples/myVideo.zip

John

UPDATE

I have just tried loading a video on my computer in the same test app and there is no problem. which suggests that it is YouTube that maybe affects your playBetween system. I was trying to find out why the same video malfunctions in my main program whereas in the small app there is no problem. In the main app if I use this: tbfunction_htmlVideoLoader("screen", false, "", "", "continuous", "", "", "", "", fileName) the video freezes when I click the play button and there is no sound. If I use this: tbfunction_htmlVideoLoader("screen", false, true, "", "continuous", "", "", "", "", fileName) there is no autoplay but the video plays normally!?
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby Clifton » Mon Nov 16, 2020 10:47 pm

Thank you for the zip file containing the troubled YouTube example.
We did make a fix to the way the playBetween property works and have uploaded PowerPac v15.071.0 which contains the fix.

Please note, however, that in Chrome you cannot load and autoplay YouTube videos. This is a browser limitation. So far Firefox and Edge seem to still allow autoplay.

Here is the working example:


And here is the full XML to configure this example:
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: this.rs

Postby John Robin Dove » Tue Nov 17, 2020 7:34 am

Thank you for fixing the problem. I downloaded the new Powerpac version. No problem with the test app. Unfortunately the error persisted in my main program. I tried to identify the parts of my program that could be causing the error but to no avail. I could not find a single culprit but using the complete program always triggered the same message: this.rs etc. I still don't have a satisfactory explanation but I have found a solution. By using a series of three 'timeswitches' (var fct = function() etc. with a 200 ms delay) I found, by trial and error, that I could make everything work as planned. So in general terms you could say my program calls all sorts of complex functions that for some reason have an adverse effect on your playBetween system.

I am well aware of the Chrome problem. You may recall we discussed it here. https://pgsoftwaretools.com/forum/viewtopic.php?t=325&#p1278 Since then there has been an additional development. If you load a video in Chrome like this tbfunction_htmlVideoLoader("screen", "youtube", false, "", "continuous", "", "", "", "", fileName); the video 'spins' (the example in your reply above illustrates this if you click on play in Chrome). I have found that by changing continuous to "" this behavior is rectified. So for Chrome I load the video without continuous and invite the user to click on the YouTube button. Once the video has been started like this the restrictions are lifted so I stop the video and reload it this time using continuous.

If I understand correctly from the information here https://developers.google.com/web/updates/2017/09/autoplay-policy-changes the problem is not necessarily specifically YouTube related but more to do with the fact that the video source is on a different server?

John

UPDATE

I spoke too soon. this.rs is undefined is still there when I use the system for Chrome described above. :cry: I cannot figure out why.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby John Robin Dove » Wed Nov 18, 2020 6:50 am

Hi Clifton,

I have made a video. I had hoped to show you the part that was working i.e. starting the video in the Firefox environment. Unfortunately this part also failed! I think this was because the BB Flashback Express Recorder was running at the same time. I have tested it again without the recorder running and there was no error which suggests that there is a timeout problem somewhere.

https://www.mediacours.com/tb_examples/MDC_video.mp4

John

UPDATE
No dobt you can fix rs but in the meantime this workaround seems to work 100% of the time.
Code: Select all
 <function name="start" event="" params="">
  <![CDATA[
  keys.noMove = true;
  tbfunction_pgTBObjSet("isLoaded", "visible", false);
  tbfunction_pgTBObjSet("start1", "enabled", false);
  tbfunction_pgTBObjSet("start2", "enabled", false);
  keys.aborted = false;
    if (keys.MSecs < keys.startPos) //WE'RE NOT STARTING AT THE BEGINNING
    {
    tbfunction_htmlVideoControl("screen", "play")
      var fct = function()
      {
      tbfunction_htmlVideoControl("screen", "currentTime", keys.startPos);
      tbfunction_setOpacity("screen", 100);
      keys.noMove = false;
      tbfunction_htmlVideoControl("screen", "play");
      }
    setTimeout(fct, 300);
    /*  USING PLAYBETWEEN
    tbfunction_htmlVideoControl("screen", "playBetween", keys.startPos + "," + keys.endPos);
      var fct = function()
      {
      tbfunction_htmlVideoControl("screen", "pause");
      tbfunction_htmlVideoControl("screen", "volume", keys.vol1);
      tbfunction_htmlVideoControl("screen", "play");
      tbfunction_setOpacity("screen", 100);
      keys.noMove = false;
      }
    setTimeout(fct, 600);
    ***/
    }
    else   //STARTING AT THE BEGINNING
    {
    keys.restarted = false;
    keys.noMove = false;
    tbfunction_setOpacity("screen", 100);
    tbfunction_htmlVideoControl("screen", "volume", keys.vol1);
    tbfunction_htmlVideoControl("screen", "play");
    }
  ]]>
  </function>

This was actually how I was doing it before I discovered playBetween.
Last edited by John Robin Dove on Wed Nov 18, 2020 8:47 am, edited 1 time in total.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby Clifton » Wed Nov 18, 2020 8:47 am

Few things to keep in mind:
  • Never call this sequence:
    htmlVideoControl( tbName, "unload" ); 
    htmlVideoLoader( tbName, ... );

    NOTE: To "unload" is built in to the call to load a video. You only need to use htmlVideoControl() to "unload" a video when that is all you want to do.
  • Also loading and reloading videos to get "continuous" monitoring is likely another problem area in your code, especially with YouTube methods. Actually, in every browser I've tried, the "continuous" monitor just always works and reloading has never been necessary.
  • After reviewing your code, I believe that stacking htmlVideoControl() too close to htmlVideoLoader() causes too many issues, especially with YouTube videos. I've been aware of the stacking issue, but after some modifications to htmlVideoControl(), the errors were eliminated. They obviously have returned in your case with the sequence of events that you are calling.
  • I wouldn't do anything else to your code right now. I'm making a change to htmlVideoControl() that queues many of the commands rather than stacking them to run as they are called. So far the results are very promising and I believe your case is a good test case to ensure it works. Some commands can still be stacked, like changing volume, muting, most "get" sequences. I've yet to encounter any error messages in any browser using your test case from the other day.
  • In addition, I've added a parameter to htmlVideoControl() which allows you to set a [delay] value. While this is automatically controlled by the function, the developer can set their own value in specific situations.
I will let you know when the PowerPac modifications have been completed and uploaded.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: this.rs

Postby John Robin Dove » Wed Nov 18, 2020 9:06 am

Thanks Clifton.

I have just discovered another thing that you are maybe already aware of: unless I'm doing something wrong, if a YouTube video is loaded I can't adjust the volume with htmlVideoControl although I can with htmlVideoLoader. This is not a great problem for me but I have only just noticed it.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron