Chuck Norris Facts!
#1
Have you ever wished you had a desktop background that would tell you random Chuck Norris facts?  Haven't we all?

Well now your wish has become a reality:
Code: (Select All)
Dim img
img = _LoadImage("https://images01.military.com/sites/default/files/styles/full/public/2021-04/chucknorris.jpeg.jpg?itok=2b4A6n29")
_PutImage , img
_Fullscreen

Do
    _Delay 2

    Dim result As Object
    result = Fetch("https://api.chucknorris.io/jokes/random")

    If result.ok Then
        Dim obj As Object
        obj = JSON.parse(result.text)
        Say obj.value   
    End If
Loop


Sub Say (text As String)
    $If Javascript Then
        var synth = window.speechSynthesis;
        if (synth) {
            var utterance = new SpeechSynthesisUtterance(text);
            synth.speak(utterance);   
            while (synth.speaking) {
                await QB.sub__Delay(.5);
            }
            success = -1;
        }
    $End If
End Sub

View in QBJS
Reply
#2
I'm going to round-house kick this into orbit!

LOL I got a forum error trying to post this first. I'm not a spammer nor troll please stupid forum quit peaking me off. I was laughing before until this happened. I've already abandoned another forum because of this B.S.
Reply
#3
I gave this a run, and there appears to be some sort of delay in the initialization of the speech.  Every quote that is read off has the first several seconds missing.  Something is off on the syncing with them, I think.
Reply
#4
(04-22-2023, 10:55 AM)SMcNeill Wrote: I gave this a run, and there appears to be some sort of delay in the initialization of the speech.  Every quote that is read off has the first several seconds missing.  Something is off on the syncing with them, I think.

Interesting, I didn’t see that in my tests.  What browser?
Reply
#5
A little delay in Opera, I thought I had to click screen to get it started. 

Maybe Chuck Norris could speed things up Smile
b = b + ...
Reply
#6
(04-22-2023, 12:41 PM)bplus Wrote: A little delay in Opera, I thought I had to click screen to get it started. 

Maybe Chuck Norris could speed things up Smile

It takes Chuck Norris 20 minutes to watch 60 Minutes.
Reply
#7
(04-22-2023, 11:04 AM)dbox Wrote:
(04-22-2023, 10:55 AM)SMcNeill Wrote: I gave this a run, and there appears to be some sort of delay in the initialization of the speech.  Every quote that is read off has the first several seconds missing.  Something is off on the syncing with them, I think.

Interesting, I didn’t see that in my tests.  What browser?

Opera, on the iPad.
Vivaldi on the PC.

Both tend to have the same delay of a few seconds upon playing for me.

Edit: Just tried with Edge on the PC and there's no delay with it, that I can tell. Things tend to start and play without being cut of any with it, letting you hear the whole quote.
Reply
#8
I  can confirm that open Chuck in Edge without any delay
but for example not work in SeaMonkey
...ahh stupid browsers


Attached Files Image(s)
   
Reply
#9
(04-22-2023, 11:04 AM)dbox Wrote:
(04-22-2023, 10:55 AM)SMcNeill Wrote: I gave this a run, and there appears to be some sort of delay in the initialization of the speech.  Every quote that is read off has the first several seconds missing.  Something is off on the syncing with them, I think.

Interesting, I didn’t see that in my tests.  What browser?

Sounds like there's going to be some digging involved.  If of any help:

 https://www.google.com/search?q=SpeechSy...-serp#ip=1

The beauty of programming with web browsers as the target: a program will work out-of-the-box on so many devices.

The problem: when using any web api's (any newer browser-engine/javascript stuff), not all browsers on all devices are at the same milestone of development/support/compatibility, occasionally because some software/device "houses" don't want to play ball/nice.  AND: testing a browser-based app for all browsers on all devices, that's a tough thing to do.
Reply
#10
Thanks for the feedback everyone!  Besides being an excuse to have Chuck Norris in a post (which was the main point), this was really just an extension of the QBJS Fun Fact #4 from the other thread that was demonstrating how you can extend the native functionality of QBJS by calling out directly to Javascript code.  This is meant to be analogous to making calls out to C libraries in QB64 or shelling out to external executables or executing assembly in QBasic to extend beyond the native functionality of QB64.  It is certainly not representative of a typical QBJS program.

So, this particular example didn't get a lot of rigorous cross-browser testing, because, again, it's just a silly Chuck Norris joke.

However, I do make an effort to test the core functionality of QBJS and the QBJS IDE in as many browsers as is feasible.  I focus on the following browsers which represent greater than 90% of the total market utilization:  Chrome, Safari, Edge, and Firefox.  I simply don't have the bandwidth to test in the more obscure browsers.  It would be analogous to trying to test QB64 for every linux distribution out there.

Lots of fun new stuff in the works for the next release that I hope to share soon!
Reply




Users browsing this thread: 2 Guest(s)