YouTube video synchronisation

2020-02-13 Thread Peter Bogdanoff via use-livecode
Hi,

Along the lines of the other conversation about sync of sound and vision:

Is there a way when I've loaded a YouTube page in the browser widget to capture 
the current time from the YouTube page video player (".html5-video-player”) as 
it plays?

Peter Bogdanoff
ArtsInteractive
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Synchronisation of sound and vision

2020-02-13 Thread Tom Glod via use-livecode
This would be so fun to work on, let us know what approach you used to get
the job done. Good luck.

On Thu, Feb 13, 2020 at 5:22 AM Ben Rubinstein via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I held off contributing to this discussion because it sounded like
> callbacks
> were a solid solution. However if that's not necessarily true it might be
> worth thinking about text tracks.
>
> This depends of course on what effect you want to achieve, and what
> platforms
> you're targeting. But way back when (cue more CD-ROM nostalgia) we
> produced a
> CD-ROM including some interviews. We put the transcript in a text track in
> Quicktime, but hid the text track from the player, and intercepted it in
> code
> so that we could present it in the way we wanted.
>
> I don't think LC let's you do that, but it does let you enable and disable
> tracks. So if you were happy with the default presentation of the text,
> that
> might be a very straightforward solution.
>
> Ben
>
> On 12/02/2020 18:57, Devin Asay via use-livecode wrote:
> > Tore,
> >
> > I would agree if callbacks were 100% reliable. I have tried them in the
> past and found that in some cases they were missed. I never had any trouble
> when using time indices. But I should say that I haven’t needed to do this
> for several years, and the callbacks in the new player object might be
> completely reliable.
> >
> > In other ways creating time indices makes your application more
> flexible, however. It’s dead simple, for instance, to set up an application
> where you can click on a line of text and play just that line. Set the
> startTime, set the endTime, set the playSelection to true, start playing.
> Done. That would be a little more challenging if all you had was callbacks.
> >
> > One of the great things about LiveCode is that there is almost always
> more than one way to do what you want.
> >
> > Regards,
> >
> > Devin
> >
> >
> > On Feb 12, 2020, at 9:55 AM, Tore Nilsen via use-livecode <
> use-livecode@lists.runrev.com>
> wrote:
> >
> > Using callbacks negate the need to fiddle with duration or  timescales
> and start or stop times. It uses the sampling intervals as is, regardless
> of time. In my opinion it is much easier than trying to calculate start and
> end times. You can easily handle large audio/video files using callbacks. I
> would recommend using one file per poem though, this simplifies the
> handling of the messages sent from the player. You can basically use the
> same message for all files, resetting a counter variable each time you load
> a new file to handle with line you would like to act upon.
> >
> > You could also store the callbacks for each audio file in a text file
> and set the callbacks as a part of the handler used to load each audio file.
> >
> > Regards
> > Tore
> >
> > 12. feb. 2020 kl. 16:49 skrev Devin Asay via use-livecode <
> use-livecode@lists.runrev.com>:
> >
> > Graham,
> >
> > Take a look at the duration and the timeScale properties of player
> objects. By dividing duration by timeScale you get the length of the video
> in seconds.
> >
> >
> > put the duration of player  “foo” / the timescale of player  “foo” into
> totalSeconds
> >
> > What you are contemplating is very doable, but you’ll have to do a fair
> amount of work to do to get the synching right. You can take one of several
> approaches:
> >
> > - Calculate times as above to predict when to show/highlight the next
> line. Can be tricky with long video files and rounding errors.
> >
> > - Check the currentTime property of the player to determine the
> startTime and endTime of each spoken line, and set the playSelection of the
> player to true. When the played segment ends, immediately load the
> following start and end times and play again. Something like this, from
> memory:
> >
> > set the startTime of player “foo” to 444
> > set the endTime of player “foo” to 999
> > set the currentTime of player “foo” to the startTime of player “foo”
> > set the playerSelection of player “foo” to true
> > start player “foo"
> > - Break up the video or audio file into separate files, one line per
> file, then play each succeeding file when the previous one reaches its end.
> The playStopped message is your friend here.
> >
> > Like I said, it’s doable, but takes a bit of thought and planning,
> creating segment indexes, that sort of thing.
> >
> > Hope this helps.
> >
> > Devin
> >
> >
> > On Feb 12, 2020, at 5:28 AM, Graham Samuel via use-livecode <
> use-livecode@lists.runrev.com >> wrote:
> >
> > Thanks, that’s a start - I will look at the dictionary. I suppose the
> callbacks rely on one analysing how long each line/word takes the performer
> to say. It’s a lot of work, but there’s no way around it since potentially
> every line takes a different length of time to recite. If it’s too much
> work, I 

Re: revprintfield and RIGHT tabalign?

2020-02-13 Thread dunbarx--- via use-livecode
Sssh.
OK.
Craig


-Original Message-
From: Klaus major-k via use-livecode 
To: How to use LiveCode 
Cc: Klaus major-k 
Sent: Thu, Feb 13, 2020 3:50 pm
Subject: Re: revprintfield and RIGHT tabalign?

Hi Craig,

> Am 13.02.2020 um 21:43 schrieb dunbarx--- via use-livecode 
> :
> 
> Klaus.
> I made a test stack and printed to pdf. Mine had a long string at the right 
> side of one line.
> Everything came out fine. Mac 10.13.4, LC 9.5.1

h... :-/

> Why are you not in the forum, where it is so easy to post screen shots?

Sometimes I need a quick answer, which is not always the case in the forum.
OTH, I often do not get a helpful answer here on the list!

P.S.
Maybe I can send you the my stack privately and you send me the PDF back?

> Craig

Best

Klaus
--
Klaus Major
https://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: curl in LiveCode

2020-02-13 Thread matthias rebbe via use-livecode
Hi again, 
rereading my post i noticed that the Accept...   is also a header.
So this a modified version of my sample script

-- build header

put 
"Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab"
 into pHeaders -- api key

put return & "Accept:=application/json" after pHeaders -- request JSON

-- now build url with parameters
put "https://api.abuseipdb.com/api/v2/check; into pURL

put "?ipAddress=172.217.9.174" after pURL -- add ip address

put "=90" after pUrl -- this is just to show how additional 
parameters are added to the url

put "" after pURL -- this is just to show how additional parameters are 
added to the url

-- now get the data 
put tsNetGetSync(pURL, pHeaders, rOutHeaders, rResult, rBytes) into tResult

put rOutHeaders after message -- show the received headers in message box 


-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 13.02.2020 um 22:45 schrieb matthias rebbe via use-livecode 
> :
> 
> Hi,
> 
> i just did a short test
> 
> this works so far
> put 
> "Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab"
>  into pHeaders
> put 
> tsNetGetSync("https://api.abuseipdb.com/api/v2/check?ipAddress=172.217.9.174;,
>  pHeaders, rOutHeaders, rResult, rBytes) into tResult
> 
> tResult contains the same value as  the one returned executing curl via shell.
> 
> The only thing i don´t know is where and how to add the 
> Accept:=application/json
> 
> 
> 
> 
> -
> Matthias Rebbe
> Life Is Too Short For Boring Code
> 
>> Am 13.02.2020 um 22:27 schrieb Andrew Bell via use-livecode 
>> :
>> 
>> An API that I use was sunset on 2020-02-01 so I need to convert my previous 
>> stack calls from their v1 to v2 format. The original method was a simple url 
>> post but the updated method uses GET via curl. I was able to convert my 
>> calls to the new format, and can successfully get data when using curl 
>> through Terminal, but can't figure out how to properly curl in LiveCode.
>> 
>> There are several old posts (mailing list and forum) that explain how to 
>> setup httpHeaders then POST or PUT using libURL, but I can't seem to find a 
>> GET option. Running a shell command works, but I'd prefer a method that 
>> ports to mobile if possible. I tried a couple tsNet commands, but keep 
>> getting assorted 4xx response codes...
>> tsNetGet - 422
>> tsNetCustom - 400
>> tsNetPost - 405
>> 
>> Can anyone explain how to issue this curl command through tsNet or libURL 
>> and read the JSON that is returned?
>> curl -G --header 
>> "Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab"
>>  --header Accept:=application/json --data ipAddress=172.217.9.174 
>> https://api.abuseipdb.com/api/v2/check
>> 
>> That is a working API key that I'm willing to throw away now that is public.
>> v1 of API is @ https://www.abuseipdb.com/api
>> v2 of API is @ https://docs.abuseipdb.com/
>> 
>> --Andrew Bell
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: curl in LiveCode

2020-02-13 Thread matthias rebbe via use-livecode
Hi,

i just did a short test

this works so far
put 
"Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab"
 into pHeaders
put 
tsNetGetSync("https://api.abuseipdb.com/api/v2/check?ipAddress=172.217.9.174;, 
pHeaders, rOutHeaders, rResult, rBytes) into tResult

tResult contains the same value as  the one returned executing curl via shell.

The only thing i don´t know is where and how to add the Accept:=application/json




-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 13.02.2020 um 22:27 schrieb Andrew Bell via use-livecode 
> :
> 
> An API that I use was sunset on 2020-02-01 so I need to convert my previous 
> stack calls from their v1 to v2 format. The original method was a simple url 
> post but the updated method uses GET via curl. I was able to convert my calls 
> to the new format, and can successfully get data when using curl through 
> Terminal, but can't figure out how to properly curl in LiveCode.
> 
> There are several old posts (mailing list and forum) that explain how to 
> setup httpHeaders then POST or PUT using libURL, but I can't seem to find a 
> GET option. Running a shell command works, but I'd prefer a method that ports 
> to mobile if possible. I tried a couple tsNet commands, but keep getting 
> assorted 4xx response codes...
> tsNetGet - 422
> tsNetCustom - 400
> tsNetPost - 405
> 
> Can anyone explain how to issue this curl command through tsNet or libURL and 
> read the JSON that is returned?
> curl -G --header 
> "Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab"
>  --header Accept:=application/json --data ipAddress=172.217.9.174 
> https://api.abuseipdb.com/api/v2/check
> 
> That is a working API key that I'm willing to throw away now that is public.
> v1 of API is @ https://www.abuseipdb.com/api
> v2 of API is @ https://docs.abuseipdb.com/
> 
> --Andrew Bell
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


curl in LiveCode

2020-02-13 Thread Andrew Bell via use-livecode
An API that I use was sunset on 2020-02-01 so I need to convert my  
previous stack calls from their v1 to v2 format. The original method  
was a simple url post but the updated method uses GET via curl. I was  
able to convert my calls to the new format, and can successfully get  
data when using curl through Terminal, but can't figure out how to  
properly curl in LiveCode.


There are several old posts (mailing list and forum) that explain how  
to setup httpHeaders then POST or PUT using libURL, but I can't seem  
to find a GET option. Running a shell command works, but I'd prefer a  
method that ports to mobile if possible. I tried a couple tsNet  
commands, but keep getting assorted 4xx response codes...

tsNetGet - 422
tsNetCustom - 400
tsNetPost - 405

Can anyone explain how to issue this curl command through tsNet or  
libURL and read the JSON that is returned?
curl -G --header  
"Key:e9242121ffd235b16f06c6e09cfd4373d18aa85d77dab4b858601051d4dd5b914ec298a3a29520ab" --header Accept:=application/json --data ipAddress=172.217.9.174  
https://api.abuseipdb.com/api/v2/check


That is a working API key that I'm willing to throw away now that is public.
v1 of API is @ https://www.abuseipdb.com/api
v2 of API is @ https://docs.abuseipdb.com/

--Andrew Bell


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: revprintfield and RIGHT tabalign?

2020-02-13 Thread Klaus major-k via use-livecode
Hi Craig,

> Am 13.02.2020 um 21:43 schrieb dunbarx--- via use-livecode 
> :
> 
> Klaus.
> I made a test stack and printed to pdf. Mine had a long string at the right 
> side of one line.
> Everything came out fine. Mac 10.13.4, LC 9.5.1

h... :-/

> Why are you not in the forum, where it is so easy to post screen shots?

Sometimes I need a quick answer, which is not always the case in the forum.
OTH, I often do not get a helpful answer here on the list!

P.S.
Maybe I can send you the my stack privately and you send me the PDF back?

> Craig

Best

Klaus
--
Klaus Major
https://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: revprintfield and RIGHT tabalign?

2020-02-13 Thread dunbarx--- via use-livecode
Klaus.
I made a test stack and printed to pdf. Mine had a long string at the right 
side of one line.
Everything came out fine. Mac 10.13.4, LC 9.5.1
Why are you not in the forum, where it is so easy to post screen shots?
Craig


-Original Message-
From: Klaus major-k via use-livecode 
To: How to use LiveCode 
Cc: Klaus major-k 
Sent: Thu, Feb 13, 2020 2:30 pm
Subject: revprintfield and RIGHT tabalign?

Hi friends,

I am trying to print a field, but when it comes to a right aligned TAB
things go awray in the resulting PDF/printout.

LC 9.5.1, macOS 10.14.6

Please take a look here:

LC field on the right, PDF on the left.
At the bottom the TAB align and TAB stops of the field to be printed

Please note the unwanted wrapping of the first two "TOTAL für..." lines!?
But it only wraps if the text exceeds a certain length? 
No wrapping if I only supply the actual SUM in the TOTAL line. 
What am I missing?

Thanks for any hints!


Best

Klaus
--
Klaus Major
https://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


revprintfield and RIGHT tabalign?

2020-02-13 Thread Klaus major-k via use-livecode
Hi friends,

I am trying to print a field, but when it comes to a right aligned TAB
things go awray in the resulting PDF/printout.

LC 9.5.1, macOS 10.14.6

Please take a look here:

LC field on the right, PDF on the left.
At the bottom the TAB align and TAB stops of the field to be printed

Please note the unwanted wrapping of the first two "TOTAL für..." lines!?
But it only wraps if the text exceeds a certain length? 
No wrapping if I only supply the actual SUM in the TOTAL line. 
What am I missing?

Thanks for any hints!


Best

Klaus
--
Klaus Major
https://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Synchronisation of sound and vision

2020-02-13 Thread Ben Rubinstein via use-livecode
I held off contributing to this discussion because it sounded like callbacks 
were a solid solution. However if that's not necessarily true it might be 
worth thinking about text tracks.


This depends of course on what effect you want to achieve, and what platforms 
you're targeting. But way back when (cue more CD-ROM nostalgia) we produced a 
CD-ROM including some interviews. We put the transcript in a text track in 
Quicktime, but hid the text track from the player, and intercepted it in code 
so that we could present it in the way we wanted.


I don't think LC let's you do that, but it does let you enable and disable 
tracks. So if you were happy with the default presentation of the text, that 
might be a very straightforward solution.


Ben

On 12/02/2020 18:57, Devin Asay via use-livecode wrote:

Tore,

I would agree if callbacks were 100% reliable. I have tried them in the past 
and found that in some cases they were missed. I never had any trouble when 
using time indices. But I should say that I haven’t needed to do this for 
several years, and the callbacks in the new player object might be completely 
reliable.

In other ways creating time indices makes your application more flexible, 
however. It’s dead simple, for instance, to set up an application where you can 
click on a line of text and play just that line. Set the startTime, set the 
endTime, set the playSelection to true, start playing. Done. That would be a 
little more challenging if all you had was callbacks.

One of the great things about LiveCode is that there is almost always more than 
one way to do what you want.

Regards,

Devin


On Feb 12, 2020, at 9:55 AM, Tore Nilsen via use-livecode 
mailto:use-livecode@lists.runrev.com>> wrote:

Using callbacks negate the need to fiddle with duration or  timescales and 
start or stop times. It uses the sampling intervals as is, regardless of time. 
In my opinion it is much easier than trying to calculate start and end times. 
You can easily handle large audio/video files using callbacks. I would 
recommend using one file per poem though, this simplifies the handling of the 
messages sent from the player. You can basically use the same message for all 
files, resetting a counter variable each time you load a new file to handle 
with line you would like to act upon.

You could also store the callbacks for each audio file in a text file and set 
the callbacks as a part of the handler used to load each audio file.

Regards
Tore

12. feb. 2020 kl. 16:49 skrev Devin Asay via use-livecode 
mailto:use-livecode@lists.runrev.com>>:

Graham,

Take a look at the duration and the timeScale properties of player objects. By 
dividing duration by timeScale you get the length of the video in seconds.


put the duration of player  “foo” / the timescale of player  “foo” into 
totalSeconds

What you are contemplating is very doable, but you’ll have to do a fair amount 
of work to do to get the synching right. You can take one of several approaches:

- Calculate times as above to predict when to show/highlight the next line. Can 
be tricky with long video files and rounding errors.

- Check the currentTime property of the player to determine the startTime and 
endTime of each spoken line, and set the playSelection of the player to true. 
When the played segment ends, immediately load the following start and end 
times and play again. Something like this, from memory:

set the startTime of player “foo” to 444
set the endTime of player “foo” to 999
set the currentTime of player “foo” to the startTime of player “foo”
set the playerSelection of player “foo” to true
start player “foo"
- Break up the video or audio file into separate files, one line per file, then 
play each succeeding file when the previous one reaches its end. The 
playStopped message is your friend here.

Like I said, it’s doable, but takes a bit of thought and planning, creating 
segment indexes, that sort of thing.

Hope this helps.

Devin


On Feb 12, 2020, at 5:28 AM, Graham Samuel via use-livecode 
mailto:use-livecode@lists.runrev.com>>
 wrote:

Thanks, that’s a start - I will look at the dictionary. I suppose the callbacks 
rely on one analysing how long each line/word takes the performer to say. It’s 
a lot of work, but there’s no way around it since potentially every line takes 
a different length of time to recite. If it’s too much work, I guess I can just 
display the whole text and have one callback at the end of each recording. 
Maybe that is really the practical solution for a large body of work (say all 
the Shakespeare sonnets, for example).

Anyway thanks for the hint.

Graham

On 12 Feb 2020, at 12:16, Tore Nilsen via use-livecode 
mailto:use-livecode@lists.runrev.com>>
 wrote:

You will have to use the callbacks property of the player to do what you want 
to do. The callbacks list would be your cues. From the dictionary:

The callbacks of a player <> is