photo/video-slideshow getting content from webserver

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
propeller
Posts: 19
Joined: Sat Oct 13, 2018 12:22 pm
Location: Austria

photo/video-slideshow getting content from webserver

Post by propeller » Sat Oct 13, 2018 12:54 pm

Hi there!

I stumbled upon livecode and now i am curious. I plan to develop an app and would like to know if it is possible to do with livecode and how difficult it would be to create it. I have some experience in javascript but it is far from professional level.

The app should be running on android. Its task would be to display photos and videos which are in a folder on a server. The device, which the app would be running on, will be connected to the internet via wlan.

I would be happy, if you experts give me your opinions on this.
Have a nice day!

Klaus
Posts: 10477
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: photo/video-slideshow getting content from webserver

Post by Klaus » Sat Oct 13, 2018 1:21 pm

Hi propeller,

welcome to the forum!

Yep, that's an easy one, in LC you can do something like this:

Code: Select all

...
set the filename of img "your_image" to "https://www.a_server.com/a_folder_with_images/image666.jpg"
...
So the answer to your question is: Yes, doable! :D


Best

Klaus

propeller
Posts: 19
Joined: Sat Oct 13, 2018 12:22 pm
Location: Austria

Re: photo/video-slideshow getting content from webserver

Post by propeller » Sat Oct 13, 2018 1:36 pm

Thank you Klaus. So i guess, i would have to read out the folder to get all the filenames, store it in an array or something which declares if it is an image or a video and then play it. Seems doable :)

bogs
Posts: 2377
Joined: Sat Feb 25, 2017 10:45 pm

Re: photo/video-slideshow getting content from webserver

Post by bogs » Sat Oct 13, 2018 2:55 pm

propeller wrote:
Sat Oct 13, 2018 1:36 pm
So i guess, i would have to read out the folder to get all the filenames, store it in an array or something which declares if it is an image or a video and then play it.
Hum. Well, actually, you don't have to do the storing in an array, Lc has 2 functions that already do this, the files and the folders.

You can loop through those and put them directly into a text field for selection. Example for the folders would look like :

Code: Select all

// code using a field to visibly show the list, could just as easily be any variable or custom property...
   repeat with x = 1 to the number of lines of the folders
      put line x  of the folders & cr after field "dirList"
   end repeat
Once you select a folder, you can list the files :

Code: Select all

   repeat with x = 1 to the number of lines of the files
// this is only one way to filter, there are a *lot* of other ways...
      if line x of the files contains ".jpg" or (line x of the files contains ".png") or (line x of the files contains ".bmp") then
         put line x  of the files & cr after field "dirList"
      end if
   end repeat
The above gives you a rudimentary file browser. I don't do mobile, but you might not even have to write the above if the file dialogs work on it. Maybe Jacque or someone that does android could detail that part farther.
Image

Klaus
Posts: 10477
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: photo/video-slideshow getting content from webserver

Post by Klaus » Sat Oct 13, 2018 3:43 pm

Hi propeller,
Thank you Klaus. So i guess, i would have to read out the folder to get all the filenames, store it in an array or something which declares if it is an image or a video and then play it. Seems doable.
yes, any PHP (or even LC server) script that fetches the files from a folder on the server will do.


@ Bogs,
we are talking about:
... display photos and videos which are in a folder on a server.
so LCs "files" command will not work here.


Best

Klaus

bogs
Posts: 2377
Joined: Sat Feb 25, 2017 10:45 pm

Re: photo/video-slideshow getting content from webserver

Post by bogs » Sat Oct 13, 2018 4:28 pm

files and folders don't work with server addresses? Huh, I thought it was just like any other url folder :|

I apologize for the mistake, propeller.
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”