andytlr / camera Goto Github PK
View Code? Open in Web Editor NEWMaking a camera app
Making a camera app
Panning left and right shows them when it shouldn't. There's some NQR behaviour. Should maybe hide them unless there's a up/down pan.
Some things are hard to do one handed and record. I.e. making coffee is pretty time sensitive.
We could add a button to the camera screen that starts a 5 second countdown then records for 5 seconds.
Migrate clip storage to an actual, real database.
E.g. ☝️ 👇 👈 👉 👌 👍 ❤️ 😎
Would be good to at least do this from the list view to camera for quick access to continue shooting.
Use background/foreground notifications to pause/play video in both the preview view and edit view:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "appWillEnterBackground", name: UIApplicationWillResignActiveNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "appDidEnterForeground", name: UIApplicationDidBecomeActiveNotification, object: nil)
Then do something like:
appWillEnterBackground() {
player.pause()
}
appDidEnterForeground() {
player.start()
}
It's shown again when you open the app which is a bit odd after the app being closed for a while.
Change camera focal point by tapping anywhere in the viewfinder
It doesn't also export the video. Tapping save any subsequent time works as expected.
The docs say, by default it's set to AVAudioSessionCategorySoloAmbient
:
The category for default category, used unless you set a category with the setCategory:error: or setCategory:withOptions:error: method.
Your audio is silenced by screen locking and by the Silent switch (called the Ring/Silent switch on iPhone).
By default, using this category implies that your app’s audio is nonmixable—activating your session will interrupt any other audio sessions which are also nonmixable. To allow mixing, use the AVAudioSessionCategoryAmbient category instead.
It's interesting that the default is supposed to respect the mute switch. It doesn't, so perhaps video playback clobbers this...
Almost certainly what we want and what I have set is AVAudioSessionCategoryAmbient
:
The category for an app in which sound playback is nonprimary—that is, your app can be used successfully with the sound turned off.
This category is also appropriate for “play along” style apps, such as a virtual piano that a user plays while the Music app is playing. When you use this category, audio from other apps mixes with your audio. Your audio is silenced by screen locking and by the Silent switch (called the Ring/Silent switch on iPhone).
This should let music/podcasts keep playing and respect the mute switch. It's definitely set, try print(AVAudioSession.sharedInstance().category)
anywhere and it'll return AVAudioSessionCategoryAmbient
.
❓ ❓ ❓ ❓ ❓
Probably a plist setting to determine whether they've seen it before or not. If they haven't set the video as the initial view controller. If they have, set the camera as the initial view controller.
Maybe not ¯\_(ツ)_/¯
Take into account reordering. So this shouldn't necessarily be date order but the sort order that defaults to date.
Launch screens need to launch super quick so they're often static. But we could maybe do something fun like cycling through a whole lot of emoji real quick.
Sometimes, when coming back from the preview view the camera crashes.
I think it's when it's still set to Ambient
and it tries to add the mic.
If you drag one one, then flick back. It feels like it should go back to the start position. But because the velocity is there it keeps going.
Kind of hard to explain. If you drag towards the right to keep it, then kind of flick back to the left to cancel, it picks up the velocity to the left and it’s like “oh shit you want to delete that”.
This will make it persist in preview/edit view too.
#24 should export to the Camera Roll. But we could use the share sheet to both save the clip to camera roll and share to other apps.
Should flatten into video when saved out.
When a photo is the first item in the documents directory and you attempt to load the list view, the app crashes with:
Image generation failed with error Error Domain=AVFoundationErrorDomain Code=-11828 "Cannot Open" UserInfo={NSUnderlyingError=0x1245a3510 {Error Domain=NSOSStatusErrorDomain Code=-12847 "(null)"}, NSLocalizedFailureReason=This media format is not supported., NSLocalizedDescription=Cannot Open}
fatal error: unexpectedly found nil while unwrapping an Optional value
This is also responsible for the blue views.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.