Play Video from Vimeo
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Play Video from Vimeo
Hi,
I am new to LiveCode - My Background is PHP and MySQL. I want to show Videos from Vimeo in my
app. The URL comes from a MySQL DB which I want to fetch via XML:
<vimeo>linktovimeo/video/372847164</vimeo>
I have seen, that I should use Web Browser for that action, but I have nothing seen in the documentation how to
use Data from XML for this action?
Thank you very much for your advice and help,
All the Best,
Stefan
I am new to LiveCode - My Background is PHP and MySQL. I want to show Videos from Vimeo in my
app. The URL comes from a MySQL DB which I want to fetch via XML:
<vimeo>linktovimeo/video/372847164</vimeo>
I have seen, that I should use Web Browser for that action, but I have nothing seen in the documentation how to
use Data from XML for this action?
Thank you very much for your advice and help,
All the Best,
Stefan
Re: Play Video from Vimeo
Hi Stefan,
welcome to the forum!
Are you german? Stefan sounds like this, if yes, there is also a german LC forum:
http://www.livecode-blog.de/forums/foru ... ode-forum/
OK, what part do you need help with?
Extracting the VIMEO part form the XML or setting up the browser widget?
Best
Klaus
welcome to the forum!
Are you german? Stefan sounds like this, if yes, there is also a german LC forum:
http://www.livecode-blog.de/forums/foru ... ode-forum/
OK, what part do you need help with?
Extracting the VIMEO part form the XML or setting up the browser widget?
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Play Video from Vimeo
Please post here as well if you also post to the German forum. Sounds interesting
Craig
Craig
Re: Play Video from Vimeo
Hi Klaus
thank you for your feedbck. I am Austrian, so the German Forum might also work I have seen the tutorial
/m/4071/l/7011-how-to-read-in-data-from-an-xml-file
but there the XML File will be load from Desktop, how can I read from Web XML?
This is my XML File:
So in my case, I have to do something like this:
How can I get the Variable "aRecords[tID]["vimeo"] into the Web Browser?
Thank you very much,
Stefan
thank you for your feedbck. I am Austrian, so the German Forum might also work I have seen the tutorial
/m/4071/l/7011-how-to-read-in-data-from-an-xml-file
but there the XML File will be load from Desktop, how can I read from Web XML?
This is my XML File:
Code: Select all
<messen>
<messe>
<id>1</id>
<messe_1>Badener Hochzeitstage 2020</messe_1>
<vimeo>/video/372844380</vimeo>
</messe>
<messe>
<id>3</id>
<messe_1>Kärntner Hochzeitstage 2021</messe_1>
<vimeo>/video/364883457</vimeo>
</messe>
</messen>
Code: Select all
function readxml pFilePath
local tXMLTreeID
local tRoot
local tResponse
local tChildNode
local tID
local aRecords
put revCreateXMLTreeFromFile(pFilePath, false, true, false) into tXMLTreeID
put revXMLRootNode(tXMLTreeID) into tRoot -- "messen"
put revXMLFirstChild(tXMLTreeID,tRoot) into tResponse -- "messe"
repeat while "xmlerr" is not in tResponse
put revXMLNodeContents(tXMLTreeID, tResponse & "/id") into tID
put revXMLNodeContents(tXMLTreeID, tResponse & "/messe_1") into aRecords[tID]["messe_1"]
put revXMLNodeContents(tXMLTreeID, tResponse & "/vimeo") into aRecords[tID]["vimeo"]
put revXMLNextSibling(tXMLTreeID,tResponse) into tResponse
if tResponse is empty then
exit repeat
end if
end repeat
return aRecords
end readxml
Thank you very much,
Stefan
Re: Play Video from Vimeo
Hi Stefan,
Best
Klaus
just put it into a variable:but there the XML File will be load from Desktop, how can I read from Web XML?
Code: Select all
...
put url("http://path_to/server.com/xml_file_here.xml") into tXML
## Now parse that variable with:
## put revCreateXMLTreeFromFile(pFilePath, false, true, false) into tXMLTreeID
put revXMLCreateTree(tXML, false, true, false) into tXMLTreeID
...
Use the link in the XML tag like:How can I get the Variable "aRecords[tID]["vimeo"] into the Web Browser?
Code: Select all
...
put aRecords[tID]["vimeo"] into tVideoURL
set the url of widget "Your browser widget here..." to tVideoURL
## Done!
...
Best
Klaus
Re: Play Video from Vimeo
Hi Klaus,
thank you very much for your help and your advices. This Code is working when I connect it to a button, but how can I process it, when the
stack is loading?
Thank you very much for your feedback,
Stefan
thank you very much for your help and your advices. This Code is working when I connect it to a button, but how can I process it, when the
stack is loading?
Code: Select all
on mouseUp
loadPreferences
end mouseUp
command loadPreferences
put readPreferencesToXMLTree() into tTree
if tTree is empty then
exit loadPreferences
end if
processPreferencesTree tTree
revXMLDeleteTree tTree
end loadPreferences
private function readPreferencesToXMLTree
put url("URL") into tXML
put revXMLCreateTree(tXML, false, true, false) into tXMLTreeID
put revXMLRootNode(tXMLTreeID) into tRoot -- "messen"
put revXMLFirstChild(tXMLTreeID,tRoot) into tResponse -- "messe"
repeat while "xmlerr" is not in tResponse
put revXMLNodeContents(tXMLTreeID, tResponse & "/id") into tID
put revXMLNodeContents(tXMLTreeID, tResponse & "/messe_1") into aRecords[tID]["messe_1"]
put revXMLNodeContents(tXMLTreeID, tResponse & "/vimeo") into aRecords[tID]["vimeo"]
put revXMLNextSibling(tXMLTreeID,tResponse) into tResponse
if tResponse is empty then
exit repeat
end if
end repeat
put aRecords[tID]["vimeo"] into tVideoURL
set the url of widget "Browser" to tVideoURL
end readPreferencesToXMLTree
private function processPreferencesTree tTree
put aRecords[tID]["vimeo"] into tVideoURL
set the url of widget "Browser" to tVideoURL
end processPreferencesTree
Stefan
Re: Play Video from Vimeo
Hi Stefan,
put your handlers and functions into the stackscript and then add this:
Best
Klaus
put your handlers and functions into the stackscript and then add this:
Code: Select all
on openstack
## Your other openstackstuff here...
## ... and here...
## Give the engine time to load all libraries etc:
send "loadPreferences" to this stack in 10
## = 10 ticks = 1/6 second
## 1 second = 60 ticks
end openstack
Klaus
Re: Play Video from Vimeo
Hi Klaus,
thank you very much for your help. It works like a charm
When I try to work with random numbers, I try to work with
But I do not get any result. I think it is because I have to mask the variable. What is the syntax in LiveCode?
All the best,
Stefan
thank you very much for your help. It works like a charm
When I try to work with random numbers, I try to work with
Code: Select all
put random(1) + 4 into rNumber
put url("URL?messe=rNumber") into tXML
All the best,
Stefan
Re: Play Video from Vimeo
You are passing the STRING rNumber and not its content!
Code: Select all
...
put random(1) + 4 into rNumber
put url("URL?messe=" & rNumber) into tXML
...
Re: Play Video from Vimeo
Hi Klaus,
thank you very much. When I return the variable "rNumber", then it will be shown correct, but when I use
it with the URL then it is always "empty". I am using a field, there I see the error:
I just have 5 entries in this table of the db.
Thanks again for your help and advices!
thank you very much. When I return the variable "rNumber", then it will be shown correct, but when I use
it with the URL then it is always "empty". I am using a field, there I see the error:
Code: Select all
put random(3) + 1 into rNumber
return rNumber
xmlerr, can't find element
Code: Select all
on openstack
send "loadPreferences" to this stack in 10
end openstack
command loadPreferences
put readPreferencesToXMLTree() into tTree
if tTree is empty then
exit loadPreferences
end if
end loadPreferences
private function readPreferencesToXMLTree
put random(3) + 1 into rNumber
put url("URLTO?messe= & rNumber") into tXML
put revXMLCreateTree(tXML, false, true, false) into tXMLTreeID
put revXMLRootNode(tXMLTreeID) into tRoot -- "messen"
put revXMLFirstChild(tXMLTreeID,tRoot) into tResponse -- "messe"
repeat while "xmlerr" is not in tResponse
put revXMLNodeContents(tXMLTreeID, tResponse & "/id") into tID
put revXMLNodeContents(tXMLTreeID, tResponse & "/messe_1") into aRecords[tID]["messe_1"]
put revXMLNodeContents(tXMLTreeID, tResponse & "/vimeo") into aRecords[tID]["vimeo"]
put revXMLNextSibling(tXMLTreeID,tResponse) into tResponse
if tResponse is empty then
exit repeat
end if
end repeat
put aRecords[tID]["vimeo"] into tVideoURL
set the url of widget "Browser" to tVideoURL
put aRecords[tID]["messe_1"] into field "Field"
end readPreferencesToXMLTree
Re: Play Video from Vimeo
Code: Select all
...
put url("URLTO?messe=" & rNumber) into tXML
...
Re: Play Video from Vimeo
Oh, I am soo stupid...
All the best,
Stefan
PS: Next step: Data Grid!
All the best,
Stefan
PS: Next step: Data Grid!