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

Only honoring the initial camera view styles #7

Open
Benmidi opened this issue Sep 1, 2015 · 10 comments
Open

Only honoring the initial camera view styles #7

Benmidi opened this issue Sep 1, 2015 · 10 comments

Comments

@Benmidi
Copy link

Benmidi commented Sep 1, 2015

We're running into an issue where we have a small version of the camera in an initial component. To let people know that we're going to be recording their response. When we transition to the next component even though we supply a different set of dimensions in the styles the camera renders with the previously specified styles.

Bee Tee Dubz - Awesome job on the library!

@maxs15
Copy link
Owner

maxs15 commented Sep 1, 2015

Hey ben,
Are you sure that you rerender your component correctly after applying the new dimensions in your style ?
I didn't have much time recently but I'm going to spend some time to improve this module, lot of work !
If you find any solution to fix a bug, PR are welcomed

@Benmidi
Copy link
Author

Benmidi commented Sep 4, 2015

We're definitely re-rendering. The recorder is being required into two separate components with entirely different states and styles. To get around the issue (in our tight timeline) we're using both your component and react-native-camera. I hope to take more time to figure out the underlying reasons and to add saveToCamera (when I do, I'll submit a PR.)

@Benmidi
Copy link
Author

Benmidi commented Sep 4, 2015

Oh, just found the issue. It's because of the view init function. It returns any previously initialized view.
We removed the if statement and we were able to get the styles to work. Not sure if this introduces a memory issue, it's probably better to use the existing one and somehow change the bounds whenever it's called subsequently.

https://github.com/maxs15/react-native-screcorder/blob/master/ios/RNRecorderManager.m#L24-L31

@maxs15
Copy link
Owner

maxs15 commented Sep 8, 2015

You're right !
I'm gonna have to do some tests, will submit a PR soon.

@ms88privat
Copy link

@maxs15 Thanks for this awesome lib! Is this PR still coming?

edit: Would be perfect to initialise the camera upfront and show it later (in a different place) instantaneously (and destroy it via method too)! At the moment it takes quite a'lot of time to initialise (especially if you changed the camera from back to front last time)

@maxs15
Copy link
Owner

maxs15 commented Nov 12, 2015

Sorry, totally forgot about it.
Did it solve the issue for you by removing the if statement in the view method ?
I doesn't solve the problem on my side

@ms88privat
Copy link

@maxs15 I did not change my view styles, so I don't know about that. But it will not re-render my sub-components anymore. Before that, all my sub-components (e.g. segmentBar, controls, ..) got duplicated.

Please have a look at my new issue also. Thanks 👍

@ms88privat
Copy link

I don't get it why this behaves so differently on the first appearance?

I changed this code

// Alloc UI element
if (_recorderView == nil) {
    _recorderView = [[RNRecorder alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
}
return _recorderView;

to this code (to handle multiple videos etc., which is working great with this version!):

_recorderView = nil;
_recorderView = [[RNRecorder alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
return _recorderView;

But now the big problem is that I have to transition two times to the same record view before I can save my recorded video.... (see issue #9)

Anyone have an Idea?

@ms88privat
Copy link

@maxs15 any news here?

I can not write Objective-C. I would really like to know, why I have to render the RecorderComponent two times, before I am able to save the recorded video.

Also your actual implementation (without my "fix" above), does not allow to record multiple videos and save them in different files (but it can save the Video on the first time RecorderComponent appears...)

Thank you!

@maxs15
Copy link
Owner

maxs15 commented Dec 11, 2015

It appears that there is some issues with SCRecorder when creating multiple instances, no news for now I currently don't have much time to investigate this issue..
Why couldn't you save multiple files ? I don't know exactly what you want to do, but when the video is saved you'll get an url to the file.
After that, it's your job to do whatever you want with it, you could upload it or copy it somewhere in the filesystem with a plugin like react-native-fs

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

3 participants