-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Media Recorder implementation Android and iOS #1810
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
Media Recorder implementation Android and iOS #1810
Conversation
@cloudwebrtc Can you have a look at this? Tested on latest version of flutter and everything seems ok. |
hey, thanks for the PR, I will review this PR and its related later this week. |
NSNumber* recorderId = argsMap[@"recorderId"]; | ||
NSString* path = argsMap[@"path"]; | ||
NSString* trackId = argsMap[@"videoTrackId"]; | ||
NSString* audioTrackId = argsMap[@"audioTrackId"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that you had to use a dependency override just to provide audioTrackId. I used this workaround instead to avoid making additional changes.
- (NSString *)audioTrackIdForVideoTrackId:(NSString *)videoTrackId {
NSString *audioTrackId = nil;
// Iterate through all peerConnections
for (NSString *peerConnectionId in self.peerConnections) {
RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
// Iterate through the receivers to find the video track
for (RTCRtpReceiver *receiver in peerConnection.receivers) {
RTCMediaStreamTrack *track = [receiver valueForKey:@"track"];
if ([track.kind isEqualToString:@"video"] && [track.trackId isEqualToString:videoTrackId]) {
// Found the video track, now look for the audio track in the same peerConnection
for (RTCRtpReceiver *audioReceiver in peerConnection.receivers) {
RTCMediaStreamTrack *audioTrack = [audioReceiver valueForKey:@"track"];
if ([audioTrack.kind isEqualToString:@"audio"]) {
audioTrackId = audioTrack.trackId;
break;
}
}
break;
}
}
// If the audioTrackId is found, break out of the loop
if (audioTrackId != nil) {
break;
}
}
return audioTrackId;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed your suggestion and created the audioTrackIdForVideoTrackId method. I also refactored the code and removed audioTrack from the methodChannel, since the videoTrack alone is sufficient. Please let me know if everything looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cloudwebrtc can you check this?
LGTM |
This reverts commit 04ccd08.
This PR adds media recorder support for iOS and fix Android implementation. The core implementation was originally submitted in this PR, but it had become outdated and had merge conflicts. I resolved the conflicts and fixed additional issues that appeared during testing.
Issues that were fixed:
The implementation has been tested across a variety of devices and appears to be working well.
Current behavior:
This PR depends on two other open PRs that must be merged first:
flutter-webrtc/webrtc-interface#31
flutter-webrtc/dart-webrtc#62
Feel free to request any changes — I’ll respond quickly, as the team needs this merged as soon as possible.
Edit: The pubspec.yaml is currently pointing to a different fork to ensure the build passes. Once the interface and dart-webRTC PR's are merged, the pubspec.yaml should be updated to point to the correct version.