How should I integrate video and photo functionality in iOS app?












-3















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.










share|improve this question



























    -3















    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.










    share|improve this question

























      -3












      -3








      -3


      1






      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 3:56









      The Great VisionaryThe Great Visionary

      20117




      20117
























          3 Answers
          3






          active

          oldest

          votes


















          0





          +100









          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.






          share|improve this answer

































            -1














            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.






            share|improve this answer































              -1














              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)
              }





              share|improve this answer
























              • please add more details

                – Tilo
                Nov 24 '18 at 7:49











              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              0





              +100









              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.






              share|improve this answer






























                0





                +100









                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.






                share|improve this answer




























                  0





                  +100







                  0





                  +100



                  0




                  +100





                  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.






                  share|improve this answer















                  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.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 5 at 22:00

























                  answered Jan 5 at 21:59









                  user123user123

                  14412




                  14412

























                      -1














                      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.






                      share|improve this answer




























                        -1














                        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.






                        share|improve this answer


























                          -1












                          -1








                          -1







                          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.






                          share|improve this answer













                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 24 '18 at 4:59









                          iDev750iDev750

                          5961315




                          5961315























                              -1














                              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)
                              }





                              share|improve this answer
























                              • please add more details

                                – Tilo
                                Nov 24 '18 at 7:49
















                              -1














                              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)
                              }





                              share|improve this answer
























                              • please add more details

                                – Tilo
                                Nov 24 '18 at 7:49














                              -1












                              -1








                              -1







                              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)
                              }





                              share|improve this answer













                              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)
                              }






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 24 '18 at 7:40









                              Urvashi HirparaUrvashi Hirpara

                              11




                              11













                              • 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





                              please add more details

                              – Tilo
                              Nov 24 '18 at 7:49


















                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              404 Error Contact Form 7 ajax form submitting

                              How to know if a Active Directory user can login interactively

                              Refactoring coordinates for Minecraft Pi buildings written in Python