Hello everyone, I am learning Swift right now to develop a fitness app and I need to know, if what I have planned is practical/doable in SwiftUI:
One of the main features is supposed to be, that the user can pick short videos(max. 10sec) from their local photo/video gallery. Those videos can then be opened permanently from within the app. Now that doesn’t sound like something impossible to me… but I have never seen it done inside of a fitness app with videos, only with images. I am sure people have tried. What could be the catch?
Drag and drop the video into the assets folder in xcode. If xcode permits the drag and drop that is probably brcause xcode is just peachy with the file extension.
Then type Video(“filename”) in a view similar to Image(“imagename”) and see if xcode objects.
“Video” is probably not the correct object name syntax, but maybe you can figure out the equivalent of “Text” and “Image”.
It is not recommended to add videos into the Assets catalogue. The asset catalogue was never designed for that purpose. Videos should be added into the Bundle or better still should be stored on a remote server to avoid bloating the App.
It seems like the original poster wants to know how to display videos in an app that the user selects from his or her Photos library though. So somehow store a reference to the local video.
Hello Chris! As RedFox1 already mentioned, I am trying to carry out the whole thing locally, without a server 1) because of costs and 2) because I want this feature(watching the videos) to work offline. So I would create copies of the videos and load them into the bundle and then eventually the App would become bloated? Is the problem with that only the App taking up too much storage on the device? Or does it also become slow or something like that?
The videos can be saved to the Applications Document directory. That’s where any large data object should be saved. Much better than in the Assets catalogue.