Open csabau opened 2 years ago
There is quite a bit to unpack, so it is taking a bit of time.
My recommendation as always is to maybe slow build up the UI again in a separate project. You could duplicate the test video project you have and start from there.
the IBAction
is from the old interface builder / storyboard approach. There might be (and likely are) some extra steps to take in order to get this working with SwiftUI.
Given the Swift UI side isn't actually doing a whole lot, I wonder if it would be worthwhile knocking up a version of this in the old storyboard approach.
This would require re thinking of
ContentView
DeviceSetupView
ControlView
AppDelegate
PlayVideoView
Which isn't ideal
To the Left of the Record button I've added a new button that I want to allow the user to browse through their Photos library, being restricted just for videos and play back any videos they have there. That's because If they record a new exercise and they save it, although they can preview it before saving it, they can't go back to it, from within the app and view it again.
I've found this code : https://www.raywenderlich.com/10857372-how-to-play-record-and-merge-videos-in-ios-and-swift which does exactly that and on its own it works perfectly, but I can't seem to manage to make it work for me inside this app
I've imported the PlayVideoViewController and VideoHelper files from that original project.
I then realised that the action for starting the video controller is done by a IBAction attached to a button from the storyboard in the original file.... it looked like this:
so I've tried changing it to something that happens automatically: https://github.com/csabau/BTracking/blob/53debc1e37179fba56235aae4128fd6b19ce3ab4/BodyTracking-Example/BodyTracking-Example/PlayVideoViewController.swift#L73-L77
I then wrapped it all up just like I did with the bubble level https://github.com/csabau/BTracking/blob/53debc1e37179fba56235aae4128fd6b19ce3ab4/BodyTracking-Example/BodyTracking-Example/PlayVideoViewController.swift#L49-L63
And then added it to its own view https://github.com/csabau/BTracking/blob/53debc1e37179fba56235aae4128fd6b19ce3ab4/BodyTracking-Example/BodyTracking-Example/PlayVideoViewController.swift#L39-L46
Which I then called in The ControlView https://github.com/csabau/BTracking/blob/53debc1e37179fba56235aae4128fd6b19ce3ab4/BodyTracking-Example/BodyTracking-Example/ControlView.swift#L53-L58
But it doesn't seem to work. How does one convert an IBAction to a normal code based button pressing?