0

I'm using an external library to create a customized live streaming app.

Here is the library I'm using:

https://github.com/cine-io/cineio-broadcast-android/tree/master/cineio-broadcast-android-sdk

One of the (few) issues I have with this library is that it forces the phone to use the FRONT camera if there is one. I'd rather force to use the back camera (or have a choice, whatever).

As it is, the class that manages broadcasting in this library does have built-in public methods to choose the camera upon initialization, and its methods are private, so I can't extend it.

My solution has been to download the library locally, compile it as a local project in Gradle (I'm usnig Android Studio). Then I directly amend the library files in my project. It works.

However I'm worried this isn't a very good practice. One issue I can foresee is that the library will get upgraded - and since I'll have made changes locally it'll be very hard to take advantage of new versions of the library.

QUESTION: Is there a best practice when it comes to modifying external libraries? Is it what I am doing, or is there a better way?

Please feel free to provide feedback on the question so I can improve or clarify it as needed.

Laurent
  • 1,554
  • 19
  • 42
  • 1
    Since you're using github you might want to learn about [pull requests](https://help.github.com/articles/using-pull-requests/). This way you can send suggestions to maintainers – default locale Jan 13 '15 at 09:13
  • 1
    So - I do know about pull requests and they are super useful - but making suggestions isn't quite the same as actually getting the library to do what I want, is it? You're right that I should share my suggestions with the maintainers though - that should be a first response when I build something based on their work. – Laurent Jan 13 '15 at 09:22

3 Answers3

2

I would fork the library and push your commits to your fork. Like this you can later on merge changes in the original library to your fork as well.

Michi Gysel
  • 760
  • 6
  • 11
2

GitHub has a great collaboration model, that allows you to fork any OSS project easily. You can modify it at will, optionally, push the changes back in a form of pull requests.

Once you have your code ready to build, you can use a full free continuous integration/distribution toolchain, that is built from a cloud-based CI server of your choice (Codeship, Drone.io, Travis-CI to name a few), a free instance of Artifactory for your SNAPSHOTs (intermediate build results) and Bintray as a distribution platform (built-in into Android Studio for other people reuse).

Here's a video demonstration of the full stack and here's the documentation of the Artifactory/Bintray part.

JBaruch
  • 22,610
  • 5
  • 62
  • 90
0

You can use reflection (https://stackoverflow.com/a/11484158) but it isn't a good way. I think in your case it will be better to compile module from source and not to update it.

Community
  • 1
  • 1
QArea
  • 4,955
  • 1
  • 12
  • 22