How should I integrate video and photo functionality in iOS app?
I am working on a basic camera app. I have made the video part and photo part, and now need to integrate. So I was wondering, should I integrate them both into the same class/file? or should I spread them out into two separate VCs?. How would that work exactly?
Incase it helps: The app is almost the same as the snapchat camera, just a little more simple.
ios iphone swift
add a comment |
I am working on a basic camera app. I have made the video part and photo part, and now need to integrate. So I was wondering, should I integrate them both into the same class/file? or should I spread them out into two separate VCs?. How would that work exactly?
Incase it helps: The app is almost the same as the snapchat camera, just a little more simple.
ios iphone swift
add a comment |
I am working on a basic camera app. I have made the video part and photo part, and now need to integrate. So I was wondering, should I integrate them both into the same class/file? or should I spread them out into two separate VCs?. How would that work exactly?
Incase it helps: The app is almost the same as the snapchat camera, just a little more simple.
ios iphone swift
I am working on a basic camera app. I have made the video part and photo part, and now need to integrate. So I was wondering, should I integrate them both into the same class/file? or should I spread them out into two separate VCs?. How would that work exactly?
Incase it helps: The app is almost the same as the snapchat camera, just a little more simple.
ios iphone swift
ios iphone swift
asked Nov 24 '18 at 3:56
The Great VisionaryThe Great Visionary
20117
20117
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
The easiest way of doing this (and the way I did it) is to build out the camera functionality and then the video capturing functionality in 2 separate classes. Once you do this you will find that many required protocols and functions will overlap. From this point it is quite simple, all you have to do is copy paste from the video class into the photo. The photo has more components to it that's why you should start there. For example: setupDevice()
and setupInputOutput()
should overlap. So in conclusion: yes I recommend integrating into one class and setting up 2 extensions: one for the AVFoundation Video protocols and the same for Photo.
Quick tips: set up a photoOutput
and movieOutput
, furthermore the capture session
and previewLayer
should work for both and thus there should only be one of each. I as well built my cam in Snapchat-esque fashion.
Tell me if you need extra guidance.
add a comment |
You can use UIImagePickerController for both Video and Image.
lazy var picker: UIImagePickerController = {
let pickerView = UIImagePickerController()
pickerView.mediaTypes = [kUTTypeMovie as String, kUTTypeImage as String]
pickerView.sourceType = .camera
pickerView.videoQuality = .type640x480
return pickerView
}()
I have done below:
- Record video and save it to Album also send it to the server.
- Capture photo and send it to the server.
Let me know if you need further help.
add a comment |
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let img = UIImagePickerController()
img.delegate = self
img.sourceType = UIImagePickerControllerSourceType.camera;
img.mediaTypes = [kUTTypeImage as String]; //whatever u want type
img.allowsEditing = true
rootNavigationController?.present(img, animated: true, completion: nil)
}
please add more details
– Tilo
Nov 24 '18 at 7:49
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455028%2fhow-should-i-integrate-video-and-photo-functionality-in-ios-app%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The easiest way of doing this (and the way I did it) is to build out the camera functionality and then the video capturing functionality in 2 separate classes. Once you do this you will find that many required protocols and functions will overlap. From this point it is quite simple, all you have to do is copy paste from the video class into the photo. The photo has more components to it that's why you should start there. For example: setupDevice()
and setupInputOutput()
should overlap. So in conclusion: yes I recommend integrating into one class and setting up 2 extensions: one for the AVFoundation Video protocols and the same for Photo.
Quick tips: set up a photoOutput
and movieOutput
, furthermore the capture session
and previewLayer
should work for both and thus there should only be one of each. I as well built my cam in Snapchat-esque fashion.
Tell me if you need extra guidance.
add a comment |
The easiest way of doing this (and the way I did it) is to build out the camera functionality and then the video capturing functionality in 2 separate classes. Once you do this you will find that many required protocols and functions will overlap. From this point it is quite simple, all you have to do is copy paste from the video class into the photo. The photo has more components to it that's why you should start there. For example: setupDevice()
and setupInputOutput()
should overlap. So in conclusion: yes I recommend integrating into one class and setting up 2 extensions: one for the AVFoundation Video protocols and the same for Photo.
Quick tips: set up a photoOutput
and movieOutput
, furthermore the capture session
and previewLayer
should work for both and thus there should only be one of each. I as well built my cam in Snapchat-esque fashion.
Tell me if you need extra guidance.
add a comment |
The easiest way of doing this (and the way I did it) is to build out the camera functionality and then the video capturing functionality in 2 separate classes. Once you do this you will find that many required protocols and functions will overlap. From this point it is quite simple, all you have to do is copy paste from the video class into the photo. The photo has more components to it that's why you should start there. For example: setupDevice()
and setupInputOutput()
should overlap. So in conclusion: yes I recommend integrating into one class and setting up 2 extensions: one for the AVFoundation Video protocols and the same for Photo.
Quick tips: set up a photoOutput
and movieOutput
, furthermore the capture session
and previewLayer
should work for both and thus there should only be one of each. I as well built my cam in Snapchat-esque fashion.
Tell me if you need extra guidance.
The easiest way of doing this (and the way I did it) is to build out the camera functionality and then the video capturing functionality in 2 separate classes. Once you do this you will find that many required protocols and functions will overlap. From this point it is quite simple, all you have to do is copy paste from the video class into the photo. The photo has more components to it that's why you should start there. For example: setupDevice()
and setupInputOutput()
should overlap. So in conclusion: yes I recommend integrating into one class and setting up 2 extensions: one for the AVFoundation Video protocols and the same for Photo.
Quick tips: set up a photoOutput
and movieOutput
, furthermore the capture session
and previewLayer
should work for both and thus there should only be one of each. I as well built my cam in Snapchat-esque fashion.
Tell me if you need extra guidance.
edited Jan 5 at 22:00
answered Jan 5 at 21:59
user123user123
14412
14412
add a comment |
add a comment |
You can use UIImagePickerController for both Video and Image.
lazy var picker: UIImagePickerController = {
let pickerView = UIImagePickerController()
pickerView.mediaTypes = [kUTTypeMovie as String, kUTTypeImage as String]
pickerView.sourceType = .camera
pickerView.videoQuality = .type640x480
return pickerView
}()
I have done below:
- Record video and save it to Album also send it to the server.
- Capture photo and send it to the server.
Let me know if you need further help.
add a comment |
You can use UIImagePickerController for both Video and Image.
lazy var picker: UIImagePickerController = {
let pickerView = UIImagePickerController()
pickerView.mediaTypes = [kUTTypeMovie as String, kUTTypeImage as String]
pickerView.sourceType = .camera
pickerView.videoQuality = .type640x480
return pickerView
}()
I have done below:
- Record video and save it to Album also send it to the server.
- Capture photo and send it to the server.
Let me know if you need further help.
add a comment |
You can use UIImagePickerController for both Video and Image.
lazy var picker: UIImagePickerController = {
let pickerView = UIImagePickerController()
pickerView.mediaTypes = [kUTTypeMovie as String, kUTTypeImage as String]
pickerView.sourceType = .camera
pickerView.videoQuality = .type640x480
return pickerView
}()
I have done below:
- Record video and save it to Album also send it to the server.
- Capture photo and send it to the server.
Let me know if you need further help.
You can use UIImagePickerController for both Video and Image.
lazy var picker: UIImagePickerController = {
let pickerView = UIImagePickerController()
pickerView.mediaTypes = [kUTTypeMovie as String, kUTTypeImage as String]
pickerView.sourceType = .camera
pickerView.videoQuality = .type640x480
return pickerView
}()
I have done below:
- Record video and save it to Album also send it to the server.
- Capture photo and send it to the server.
Let me know if you need further help.
answered Nov 24 '18 at 4:59
iDev750iDev750
5961315
5961315
add a comment |
add a comment |
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let img = UIImagePickerController()
img.delegate = self
img.sourceType = UIImagePickerControllerSourceType.camera;
img.mediaTypes = [kUTTypeImage as String]; //whatever u want type
img.allowsEditing = true
rootNavigationController?.present(img, animated: true, completion: nil)
}
please add more details
– Tilo
Nov 24 '18 at 7:49
add a comment |
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let img = UIImagePickerController()
img.delegate = self
img.sourceType = UIImagePickerControllerSourceType.camera;
img.mediaTypes = [kUTTypeImage as String]; //whatever u want type
img.allowsEditing = true
rootNavigationController?.present(img, animated: true, completion: nil)
}
please add more details
– Tilo
Nov 24 '18 at 7:49
add a comment |
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let img = UIImagePickerController()
img.delegate = self
img.sourceType = UIImagePickerControllerSourceType.camera;
img.mediaTypes = [kUTTypeImage as String]; //whatever u want type
img.allowsEditing = true
rootNavigationController?.present(img, animated: true, completion: nil)
}
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let img = UIImagePickerController()
img.delegate = self
img.sourceType = UIImagePickerControllerSourceType.camera;
img.mediaTypes = [kUTTypeImage as String]; //whatever u want type
img.allowsEditing = true
rootNavigationController?.present(img, animated: true, completion: nil)
}
answered Nov 24 '18 at 7:40
Urvashi HirparaUrvashi Hirpara
11
11
please add more details
– Tilo
Nov 24 '18 at 7:49
add a comment |
please add more details
– Tilo
Nov 24 '18 at 7:49
please add more details
– Tilo
Nov 24 '18 at 7:49
please add more details
– Tilo
Nov 24 '18 at 7:49
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455028%2fhow-should-i-integrate-video-and-photo-functionality-in-ios-app%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown