this.rs

Workarounds and usability notes.

Re: this.rs

Postby Clifton » Wed Nov 18, 2020 9:22 am

I can load your YouTube video and change the volume using htmlVideoControl() after loading it. Works in all browsers, even IE11.

I think you have a race condition in your scripts if you cannot do this where the volume change is never received.

UPDATE:
I've uploaded PowerPac v15.073.1 for you to try with your program. I am yet to see any errors and the ability to properly stack htmlVideoControl() calls using the NEW [delay] parameter makes XML programming much simpler and straight-forward.
While the normal use of [delay] is to let the function calculate the best value, sometimes it is better to specify one yourself. The playBetween property is one case scenario where the auto-calculation may not always work in every browser or in low bandwidth settings.
tbfunction_htmlVideoLoader("screen", "youtube", false, 50, "continuous", "", "", 
"", "", "https://youtu.be/51ybZjRZag4"); //Load the YouTube video with autoplay false
//Immediately call playBetween which moves playhead and starts playback (Chrome users must click to play.)
tbfunction_htmlVideoControl("screen", "playBetween", "5000,15000", 1000); //using forced delay of at least 1000ms and bypassing auto-calculation
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: this.rs

Postby John Robin Dove » Thu Nov 19, 2020 7:32 am

Good morning Clifton,

Firstly and most importantly your new system appears to work perfectly. I have not seen this.rs once today :D

Other things:

The volume problem has mysteriously disappeared. I was using this video https://youtu.be/-Z72aGhVyyY but I really don't understand how the video itself could be causing the problem. The strange thing was that the non YouTube videos were not affected. I started this morning with identical code to yesterday and the volume controls worked exactly as planned and have continued to do so.

The 'resize screen code' is now working again although I have found that it should not be used while the video is loading but afterwards. There was a huge error in some of my code. I inadvertently typed the wrong name and tried to create a shadow in the field being used to contain the video! Perhaps this could explain why the impressive quantity of text I originally got with getHTMLContent in order to find the object id was suddenly reduced to one line. For the record this is what it does: https://www.mediacours.com/tb_examples/setScreenSize.mp4

I cannot do without the continuous parameter. Without it my system does not work. However I have found that I do not need to unload the video. I just repeat tbfunction_htmlVideoLoader("screen", "youtube", "", "", "continuous", "", "", "", "", fileName); and there is no problem. If you remember this problem only occurs with Chrome and I cannot use continuous in the initial loading because it causes the video to 'spin'.

Thank you for all your help.
John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby Clifton » Thu Nov 19, 2020 9:44 am

Glad the errors have disappeared.

I found that the "continuous" monitor is fine when initially loading the video. It does cause the buffering spinner to appear momentarily because the video is actually loading the stream. After a few seconds the spinner disappears and the normal play to activate button is all that is visible over the video. Click it and the video plays and the "continuous" monitor works fine.

NOTE: Regarding timeMarkers and the "continuous" settings it is important to note that by design these only function on the first play through. Once the video reaches the end, these features are turned off for the video until it is reloaded.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: this.rs

Postby John Robin Dove » Fri Nov 20, 2020 4:36 am

Not quite sure what you mean about the continuous setting only functioning on the first play through. As far as I can tell it functions all the time. If it didn't, most of the work I have done on video exploitation over the last six years would not work! So please don't change anything! I do not unload the video once it has been loaded but I frequently stop it. I do not use time markers at all.
John

UPDATE

I am still having trouble with Chrome. This is nothing to do with playBetween. You wrote It does cause the buffering spinner to appear momentarily but in my main program, if I use the continuous setting, the buffering never stops! And it is difficult and sometimes impossible to get the video to start even if you click on it. Something must be going on in my main program that's causing this because if I load the same video in the test app including the continuous parameter the same thing does not happen. Maybe I could show you some code or even zip the whole lot up. Maybe not today. I think I'll have some time off because this program is now driving me crazy (or crazier :). )

UPDATE 2

Re non-stop buffering. I took a short break but then decided to have another look after all. I first tried to eliminate any code that might be causing the problem. I got rid of nearly everything but the problem persisted so I pasted the screen group into the test app. Surprisingly the behavior was the same as in the big program! So it's nothing to do with my programming. I ungrouped the objects but this made no diiference. I tried removing all the objects except the container field but this made no difference either. So I'm sending you four examples. two that function correctly and two that don't. I hope they show you what I'm talking about but maybe they won't. The likely cause could well be the buggy TB 9.01 that I'm stuck with.

myVideo1.tbk functions correctly.
myVideo2.tbk does not.
myVideo3.tbk does not.
myVideo4.tbk does. https://www.mediacours.com/tb_examples/myVideo1.zip

They all use the same XML file (video1.xml). 2 and 4 have a transparent “noEntry” field on top of the container field. The unwanted buffering is present but not a problem in Firefox. It's not even visible because I set the opacity to 1. I can't do this in Chrome because the user must click on the video to start it and furthermore in Chrome the buffering seems to make starting difficult.

Just had an idea: if it is my Toolbook that's causing this maybe I could send you my files to save and send back.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby John Robin Dove » Sat Nov 21, 2020 8:38 am

I have spent a long time trying to see if there are any differences between myVideo1.tbk and myVideo3.tbk that could explain why they behave differently. I can find none. However, if you right click on the video once it has loaded in Firefox and get the "statistics for nerds" (this is what it says in French so I assume it's the same in English) there are many differences. I have made a native TB app to display these differences. Field A contains the statistics of the one that performs normally if I remember correctly. Surprisingly it contains fewer lines than the one that does not. https://www.mediacours.com/tb_examples/test_videos.zip I have also tried changing the source video but this makes no difference. I used this one https://youtu.be/GH0-c59YQh0 which I remember distinctly loading with no problems in earlier versions of my program.

UPDATE
Breakthrough! I ungrouped the objects that respresent the video screen and re-exported the tbk. It now functions normally. https://www.mediacours.com/tb_examples/noProblem.mp4 The question now is :o :?: WHY? :?:
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: this.rs

Postby Clifton » Sat Nov 21, 2020 11:52 am

The PowerPac fixes various mouse, click, down, up, move, focus, and selection events on nearly every exported object.

The result in all ToolBook versions is very good. However, there are some pesky bugs in v8.9 and v9.01 that while sort of resolved, they still surface. One area where this happens is when embedding video into an element. ToolBook v9.01 will not always allow click events to target the expected objects and then it doesn't always properly cancel the bubbling events. This is probably why you have some difficulty clicking on the play button in your YouTube video, etc. If you were using the rangeSlider feature of the htmlVideoControl(), you would notice buggy behavior in ToolBook v9.01 as well when dragging the start and end points of the slider. You would notice that the mouse would not release the object when you stop dragging. Most of the time ToolBook v9.01 works fine, but you are clearly entering an area of development where this behavior may be problematic. You cannot just remove the ToolBook native behavior, because that causes a host of other event-related issues; so the PowerPac modifies this behavior so that it works most of the time, but there are exceptions with ToolBook v9.01.

In your case, XML provides a near perfect workaround. Just use a <make> element to contain your videos. <make> elements will not be affected by internal ToolBook methods unless you expressly install them, which you wouldn't want to.
Here is how to do this:
  1. Rename your "screen" object to "screenAnchor". It is only used by the XML engine to set the bounds of the <make> element.
  2. Create a <make> element in your XML for the the page like this.
    <make id="screen" type="div" level="1" dims="screenAnchor" class="" refObj="screenAnchor" autoAlign="" replace="">
    <function name="myUser" event="user" params="e">
    <![CDATA[
    var valueDetail = tbfunction_pgSplitToArray(e.myValue, ",", true); //e.myValue or e.data both return the ToolBook user [value] param
    tbfunction_pgTBObjSet("result", "text", valueDetail[2]);
    ]]>
    </function>
    </make>
  3. Move all of your functions to the <make> element and adjust the way they work because the system will not send the parameters in the same way as with native ToolBook objects. I've modified the [user] event function accordingly as shown in the code above. To target this element, you would use the id "screen" just like before. In this case when the XML engine creates this element, it will give the object the name "screen" and the id "screen". This is fully HTML5 compatible.
I actually finished a project where the video player was top level 0 and auto aligned over a ToolBook object on the page. This enabled me to do other things that were necessary outside the ToolBook page frame while at the same time have access to both namespaces via the Powerpac.

I think this solution is worth a try for your project. In your case you just need to create the <make> object in level 1 as shown in my code and that should be sufficient. I tried this using your myVideo.tbk when trying to fix the playBetween issues.

UPDATE:
BTW: Just hide or original object now called "screenAnchor" so it doesn't get in the way of anything. It is only used to set the bounds of the <make> object.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: this.rs

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

Thanks very much.

Whatever Toolbook 9.01 was doing also explained the fact that I had to set autoPlay to true for non YouTube videos although I didn't require autoPlay. If I left it false the video would not start on the first click and also there was no sound!? Now it functions normally.

In any case, I have followed your advice and used make to create a non-Toolbook screen object. It did not work first time but I soon found out that it didn't like e.value but was happy with e,data. As it happens the screen object only contained one user function. Here is the code https://www.mediacours.com/tb_examples/VT2.zip for this page. As you will see. there's quite a lot of stuff :roll: . Just search for the first <make>.

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

Re: this.rs

Postby Clifton » Sun Nov 22, 2020 1:16 pm

I guess it was a typo on my part.
When referencing user event value in a <make> element, you can use e.data or e.myValue, not e.value.
Sorry.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron