Open rayalarajee opened 8 years ago
Simply,you can call this function in VCSimpleSession to On and Off audio
m_micSource->interruptionBegan();
m_micSource->interruptionEnded();
You can set micGain to 0.0f
to achieve a mute.
Unfortunately the initial value for micGain
on VCSimpleSession
seems to be 0.0f
, but it should be 1.0f
(probably a bug?). This causes the micGain = 0.0f
to be ignored until you change micGain
to a value different than 0.0f
.
What I did was to implement the didAddCameraSource:
delegate method and set the micGain
property of that session to 1.0f
(to make it "the default"):
- (void)didAddCameraSource:(VCSimpleSession *)session {
[session setMicGain:1.0f];
}
After that, you can change the micGain
property when streaming to 0.0f
(muted) or 1.0f
(normal volume).
@alejandroivan Hi ! I am using video core (0.3.2). live video stream was buffering very slow (delay timstamp minmum 1 min.) when i was playing live stream. and one more The app is freezing on iphone 6, while click on disconnect during playing video. and it's working on iphone 5 perfectly. can you please tell me.
@IOSDeveloperProgrammer I didn't code this library, but I think your buffering problem is due to the size of the image you're streaming. For example, 1280x720 is actually a very big image, and if you're using 60fps or so, it will take a lot of time to stream. Did you try something like 854x480 at 30 fps and 500 KB/s upload maximum (500 KB/s * 1024 B/KB * 8 b/B = 4,096,000 b/s -bits per second-)?
VCSimpleSession *session = [[VCSimpleSession alloc] initWithVideoSize:CGSizeMake(854, 480) frameRate:30 bitrate:4096000 useInterfaceOrientation:YES];
Algo using adaptive bitrate should help: session.useAdaptiveBitrate = YES;
.
It's actually weird that your app is freezing on an iPhone 6. Mine works fine. I have a "toggle" method that checks for status and plays or stops the stream.
- (IBAction)toggleStartStopStreaming {
switch( session.rtmpSessionState ) {
case VCSessionStateNone:
case VCSEssionStatePreviewStarted:
case VCSessionStateEnded:
case VCSessionStateError: {
[session startRtmpSessionWithURL:<YOUR_URL> andStreamKey:<YOUR_STREAM_KEY>];
break;
}
default: {
[session endRtmpSession];
break;
}
}
}
@alejandroivan Thanks for the response, sorry for the late reply. i'll applying your code and let you.
@alejandroivan FYI , i had tested on 854x480 at 30 fps and 4,096,000 b/s -bits per second. it's did not upload image. even i also add everything what did you said on that. one more thing App was crashing at [EAGLContext setCurrentContext:current]; in VCPreviewView.mm file on Video core. it's crashing after disconnect stream .
Need to On and Off audio while streaming how can we achive that one