Navigation:  Media Library >

Video and Audio Recording (Device to Server)

Previous pageReturn to chapter overviewNext page

Recording of the client's audio/video stream on the server uses the same APIs as broadcasting live Video and Audio stream. The only difference is the publishType argument for the stream call. To enable recording, the publishType to PUBLISH_RECORD as shown below:

 

Header file

UIImageView *drawImage;
BroadcastStreamClient *upstream;
RTMPClient *rtmpClient;

Class Implementation file

-(void) initConnection {
 rtmpClient = [[RTMPClient alloc] init];
 rtmpClient.delegate = self;
 [rtmpClient connect:@"rtmp://192.168.0.11:2037/MyApp"];
}
 
-(void)connect:(id)sender {        
         upstream = [[BroadcastStreamClient alloc] initWithClient:rtmpClient];
         upstream.imageView = drawImage; // contains the current video frame
         upstream.delegate = self // must be an instance of IBroadcastStreamClientDelegate
 [upstream stream:@"MyStream" publishType:PUBLISH_RECORD];
}
 
-(void)disconnect:(id)sender {        
   [upstream disconnect];
   upstream = nil;
}
 
-(void)startPublish {
   [upstream start];
}
 
-(void)stopPublish {  
   [upstream stop];
}
 
-(void)pausePublish {
   [upstream pause];
}