How do I load videos from a folder on my desktop?

0 favourites
  • 10 posts
From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • I need help! I'm a relative novice to game design, and coding in general, and need to know if the following is possible in Construct 3. Any help at all would be so appreciated!

    I have a project that needs a very basic video player, which I was able to create by uploading all my video files into the project, filling an array with the filenames of those videos, and then using them as the source for a video object.

    The problem is: I'd like to not have to upload the videos into the construct project first. Basically, I'd like to have a folder saved on my computer somewhere, that I'm able to fill with as many video files as I want. Then next time I run the Construct file, the game will automatically load the videos from that folder.

    Can this be done? Please help me, thank you!

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can using the file system plugin, although I'm not sure if it can automatically access the folder/files.

    construct.net/en/forum/construct-3/how-do-i-8/filesystem-plugin-load-local-179011

  • Thank you so much!

    After reading about the file system plugin, I was able to quickly retrieve a list of filenames from a folder on my hard drive.

    It's okay that it doesn't automatically access the folder, I'm okay with the way I have it now: Opening the file browser and navigating to the folder I need to import. I have it so that selecting that folder fills an array with the filenames of its contents.

    Now I just need help importing those files into the project. How can I get the videos in the folder into the project, so that they can be used as the source of a video object?

  • You'd first read in the file (or all files in your array if you want to load everything at once) With the "file system > Read binary file" action. This will automatically load the file into the selected binary data object. Once done loading, you can set the src tag to BinaryData.getURL. That should be it.

  • Thank you! It feels like I'm really close now!

    I was able to get it working with individual videos, but I'm having trouble finding the way to upload all videos in a selected folder.

    The way I have it right now, when a folder is selected, each item in the folder is read into a binary file, and then URL from BinaryData.GetURL is saved into an array. The idea is that the arrow keys would then let you cycle through the videos saved to the array. But it's not working, so I assume there is something I'm not quite getting.

    Here's the project file I've been testing with:

    dropbox.com/scl/fi/omqtdmi1ku8lm83ns9zcp/filesystem_videoLoad.c3p

    If you're able to take a look and help me figure out where I'm confused, I would be so appreciative!

  • I think I figured it out!

    It didn't occur to me that I'd need to create a new BinaryData object for each file loading in, but I tried and now it works perfectly.

    -

    One separate question that has now come up: Right now the folder chooser will select all files in the folder, but if a subfolder is inside that folder, neither the subfolder or its contents are included.

    For example:

    If I were to select the MainFolder in file system, it would return only:

    - video1.mp4

    - video2.mp4

    - video3.mp4

    Is there a way I could include the files contained in the subfolder? So that it would return:

    - video1.mp4

    - video2.mp4

    - video3.mp4

    - video4.mp4

    - video5.mp4

    Any help would be great.

    Thanks!

  • According to the manual

    construct.net/en/make-games/manuals/construct-3/plugin-reference/filesystem

    List content

    nly applies to folder pickers. Retrieves a list of all files and folders within a previously picked folder. The Folder path identifies a subfolder to list the contents for, or can be left empty to list the contents of the originally picked folder. The File tag is optional and allows identifying when the listing operation completes or fails with the On file operation complete/error triggers. Once completed, the available files and folders can be accessed with the FileCount, FileNameAt, FolderCount and FolderNameAt expressions.

    So you'll make a loop using FolderCount, get FolderNameAt(loopindex) and then also list that content. You'll probably want to set this up so it runs recursively until no more folders are found.

  • Awesome, that makes perfect sense!

    Thanks for all the help!! :)

  • Okay, turns out I still need a little help.

    Once I list content for the sub folder, I can't seem to iterate through the contents, because "FileSystem.FileCount" & "FileSystem.FileNameAt" seem to reference the main folder still.

    I tried playing with the File Tag, but it didn't seem to help.

  • Here's the project file, in case it's helpful: dropbox.com/scl/fi/32d08u085r3uebr3jvgqm/filesystem_videoLoad2.c3p

    Again, I'm so thankful for any help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)