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

Failure when using with WebRTC #45

Merged
merged 1 commit into from
Apr 26, 2017
Merged

Failure when using with WebRTC #45

merged 1 commit into from
Apr 26, 2017

Conversation

askarby
Copy link
Contributor

@askarby askarby commented Apr 24, 2017

Removed usage of window.URL.createObjectURL(...) in favour of returning stream directly. This has been done, since createObjectURL has been deprecated (and using it breaks WebRTC functionality when using webrtc-adapter).

image

…ng stream directly. This has been done, since createObjectURL has been deprecated (and using it breaks WebRTC functionality when using webrtc-adapter)
@schmich
Copy link
Owner

schmich commented Apr 26, 2017

Hi Anders, thanks for the contribution! Is it necessary to include the WebRTC adapter.min.js in docs/index.html?

I ask because the Instascan library itself is built with webrtc-adapter included (see package.json), specifically so it can work across browsers without requiring clients to include the WebRTC adapter library themselves.

@askarby
Copy link
Contributor Author

askarby commented Apr 26, 2017

Hi Christ.

Since you're already including webrtc-adapter in the build, you're absolutely right in assuming it's not required to include it in the docs/index.html file. I completely missed that piece of information

However - "bundling" webrtc-adapter is not something that I would consider good practice, given my use case of the library. I'm including instascan in an Angular 2 based web app, where bundling is done through webpack. In my app, webrtc-adapteris a dependency - which would lead to provide the dependency twice, resulting in a significant increase in payload size.
Another fact talking against "bundling" webrtc-adapter is that it's a shim, and shims are something that I would leave out to applications to bundle, not libraries.
I would recommend that webrtc-adapterto be a peer dependencyin package.json instead.

If you decide to implement that change (putting webrtc-adapter in the peer-dependency block of package.json), don't forget to make a new major release of instascan, to comply with semver versioning (you'll be making a breaking change).

Hope I explained everything well enough.

Let me hear what you think about it, and if you need a helping hand in implementing the change?

@schmich
Copy link
Owner

schmich commented Apr 26, 2017

That sounds reasonable. I hadn't considered the case of end users requiring webrtc-adapter themselves. I agree with you on the shim aspect, as well, it makes sense to push it out to the application level. My initial desire was to make installation as simple as possible, but this doesn't add much complexity.

There's already a bump to the major version coming, so I'll roll these changes in with that. I'm hoping to publish an update soon. I'll file an issue for the peer dependency update and get your changes integrated.

Thanks again!

@schmich schmich merged commit 0da9592 into schmich:master Apr 26, 2017
@schmich
Copy link
Owner

schmich commented Apr 26, 2017

@askarby It looks like your commit had the wrong email associated with it (anders@MacBook-Pro.local instead of anders@skarby.info).

If it's alright with you, I'll rewrite the history to update the commit with your GitHub email address.

Edit: I went ahead and updated it. Let me know if you want me to revert it.

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

Successfully merging this pull request may close these issues.

2 participants