Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When will the CocoaPod be released? #12

Closed
blurtime opened this issue Jul 19, 2019 · 17 comments
Closed

When will the CocoaPod be released? #12

blurtime opened this issue Jul 19, 2019 · 17 comments

Comments

@blurtime
Copy link
Collaborator

I'm feeling slightly embarrassed but I never had to work without CocoaPods yet and somehow cannot install it. I stumbled upon this pod on SO and seriously fell in love with it at first sight. Now I'm somewhat disappointed that I'm apparently too dumb to install the pod without my beloved CocoaPods. I tried downloading the project, opened the HybridCamera.xcodeproj but how do I get this installed to my project? I also wanted to just see what the VC.swift file looks like but I couldn't run it on my iPhone either (under HybridCameraTest it says No such module 'HybridCamLib' and under HybridCamLib it says Build input files cannot be found: ...). I would really appreciate if you could help me and I'm seriously sorry for wasting your time.

@eonist
Copy link
Owner

eonist commented Jul 20, 2019

TBH. CocoaPod is finicky to setup and maintain. Carthage is so much faster to setup when you make frameworks. Cocoapods are easy to use for consumers tho. Anyways. If you manually download the project. Then you should be able to run it out of the box on your iPhone. If you want to add the library files to your own project then maybe this will help: http://eon.codes/blog/2018/09/30/Manually-adding-a-lib/

@eonist
Copy link
Owner

eonist commented Jul 20, 2019

Might even be able to just drag in the hybridcamlib.framework and with.framework files to your Xcode project. If you don’t want to use carthage.

@blurtime
Copy link
Collaborator Author

@eonist Yes, CocoaPods is a lot easier to use... but I could bet I'm not the only one struggling with this issue when confronted with this problem. Anyway, I managed to run the project out of the box now. However, integrating it into my own project still seems impossible. I dragged the HybridCamLib/src folder and the 2 framework files (without the dSYM and exec(?)) from ⁨Carthage⁩/Build/iOS⁩ into my project. When I try to build or run it the following error occurs:
Screenshot 2019-07-20 at 13 33 56

@eonist
Copy link
Owner

eonist commented Jul 20, 2019

The .framework files must be in the embedded frameworks and linked frameworks listings. Also a xcode clean could help: cmd + shift + k then hit cmd + b to build.

@blurtime
Copy link
Collaborator Author

@eonist I've tried pretty much everything now. I've tried installing it with carthage but got an error when running carthage update, namely something with 128 exit and fatal: could not read Username for 'https://github.com': terminal prompts disabled.
Then I tried embedding the frameworks from the carthage folder mentioned above (Carthage⁩/Build/iOS⁩) by dragging them to Embedded binaries. I always cleaned the project before hitting build again and yet the same error occurs. I don't know what I am doing wrong. I would really appreciate very precise instructions on what to do with what exact file/folder but at this point, I would also understand if you had enough. Sorry

@eonist
Copy link
Owner

eonist commented Jul 20, 2019

I’ll have a look.

@eonist
Copy link
Owner

eonist commented Jul 20, 2019

I renamed the repo some time ago from HybridCam to HybridCamera. The readme didn't reflect this.
In your Cartfile change the repo name to HybridCamera and it should work. I tested it in a new project and got zero errors.

@blurtime
Copy link
Collaborator Author

Awesome! I'm sorry for taking so much of your time! But I never worked with Carthage and I was somewhat happy to find out that the installation error wasn't caused by me, was seriously getting worried there... I'm looking forward to working with the pod (your code is very clean 😌) and might even suggest adding some features that I think might be useful for others (like e.g. mirroring front camera input) if I have enough time.
Thank you very much! 🙏

@eonist
Copy link
Owner

eonist commented Jul 20, 2019

Frameworks can be finicky in Xcode.

Feel free to add cocoa support. A GitHub member added it to this repo a few weeks back: https://github.com/eonist/FileWatcher

And good luck. Camera api takes some serious focus to get right. I spent like a week with super focus in the "cave" setting up this framework.

@blurtime
Copy link
Collaborator Author

Alright, I just need to know one more thing: How can I modify the files? 😅 Currently, if I try to edit them in the Build folder, changes do not appear when I run the project - even when cleaning (the build folder, too)

@eonist
Copy link
Owner

eonist commented Jul 21, 2019

Feel free to ask away. I'm on vacay so I have time.
3 strategies you can use:

  1. Add the HybridCamera library as pure source code (aka .swift files) to your own project (easiest)
  2. Have a framework target in your project see: http://eon.codes/blog/2017/11/08/local-frameworks/ then any changes you do to the HybridCamera library will be reflected in the .framework every time you hit cmd + r
  3. Fork HybridCamera. Target your own GitHub account via Carthage: I.E: GitHub "blurtime/HybridCamera" "master" Then use Carthage update in your Main App project

Personally I use nr.3. but that's because I manage all dependencies and projects through Carthage. It's the way we are suppose to do things in 2019 and beyond. With hierarchies of packages. Reusing code. Never repeating our selfs. All other strategies leads to monolithic structures and copy pasta code. IMO 😬

I would recommend strategy nr.1 in your case, as I presume you are in the beginning stages of an app idea and just want to prototype and see if something can work.

@blurtime
Copy link
Collaborator Author

Awesome, really appreciate your support! Since I'm a Carthage expert now, I'll try 3. first 😄 if I don't get it to work, I can still go back to 1. or 2.
In case you should have... say... too much time/feel bored and might even want to spend some time coding 😅
My goal is to code a camera which can record a couple of videos, enable the user to edit the single videos (or even replace them with a new one) and finally merge them to one. I've already looked at the code and a couple of things should be in my realm of possibilities (setting a timer, getting all the video URLs from the temporary array, I also have a trimmer controller for the single videos, the code for the merging is also ready as I just recently solved an issue at swift-video-generator related to mirroring, etc.).
And mirroring the front camera videos when recording should probably be doable, too. I'll try to contribute a couple of things such that it's still very flexible but maybe offers some new features that others may be interested in as well 😉
However, there's one thing that I'm still kind of left in the dark about, namely being able to switch the camera while recording. Do you have any idea how to approach this? But really only take a look at it if you want to. I don't want to interrupt your vacation. Hope you have a good time and thank you - once again 😄

@eonist
Copy link
Owner

eonist commented Jul 22, 2019

  • Mirroring? AKA: filming with front and back at the same time? Not possible according to my research.
  • Merging videos isn't too hard. I found code on SO and GitHub for that while looking into it. But was out of scope for what I needed.
  • The next things I want to add to HybridCamera is better try error code. Instead of returning nil etc.
  • Also I will add slow-motion functionality. But that isn't on the radar at the moment. In 2020 when I Will be needing it for lightstream.to
  • I don't think its possible to switch from front to back while recording. Altho there is more precise info regarding this on SO (StackOverflow)
  • I do OpenSource in my vacay. So feel free to ask away.

@blurtime
Copy link
Collaborator Author

  • By mirroring I meant flipping the front camera input such that videos recorded with the front camera look like they do in the preview. If you currently record videos with the front camera and look at the video you will notice that it's flipped along its vertical axis. I'll try to implement it today and might show you the code later...
  • I was thinking maybe I could add merging as an option such that users can decide if they want to record just one clip at a time or record many which are merged later...
  • Regarding switching between front and back camera while recording, I've found two questions on SO which seem to offer solutions to this problem:
  1. https://stackoverflow.com/questions/47983572/switch-between-front-and-back-camera-while-recording-a-video
  2. https://stackoverflow.com/questions/13951182/audio-video-out-of-sync-after-switch-camera/54770398#54770398
    The thing is I'm not entirely sure how to implement the code. In addition to that, "Macistador" posted an answer to both questions and the solution he provides in 2. seems pretty nifty. But he provides no code at all so that would be even harder for me to implement. Therefore, I was wondering if you could maybe take a look at 1. and especially 2. since 2. seems to take care of any lag between audio and video immediately.

@eonist
Copy link
Owner

eonist commented Jul 22, 2019

  • Flipping the camera output isn't too hard I think. Can probably be done with CGAffine transform on the bitmap. Or something else. It shouldn't take too much effort to figure out and implement.
  • Regarding switching cameras, there is some lag. even in the apple provided camera app there is lag. I don't think you should worry about that at this early stage. Rather focus on getting to the MVP stage. Then refine and iron out the kinks once you have a "baby demo" of your idea working. IMO

@blurtime
Copy link
Collaborator Author

blurtime commented Jul 22, 2019

I have just created a pull request regarding the mirroring. The thing is, the demo is almost done. I've got lots of code leftover from a previous camera library I worked with and not being able to flip the camera while recording was pretty much the only thing that bothered me a little with this library (because many apps that a lot of people are used to like Snapchat and Instagram offer it and being able to do it seems so convenient). Anyway, I'll look into it some time if you currently think it's better to finish it first 😅

@eonist
Copy link
Owner

eonist commented Jul 22, 2019

I never knew you could switch the cam while filming in instagram. I never saw a video of anyone doing it either. 🤷 But its a cool feature 4 sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants