i use medialibdemos3x in my app & my problem is when i stream video in landscape mode it shows like this Image:
Image
& here is my code:
@interface ViewControllerPublish () <MPIMediaStreamEvent>{
MemoryTicker *memoryTicker;
RTMPClient *socket;
BroadcastStreamClient *upstream;
MPVideoResolution resolution;
AVCaptureVideoOrientation orientation;
UIActivityIndicatorView *netActivity;
UIDeviceOrientation deviceOrientation;}
-(void)viewDidLoad {
//[DebLog setIsActive:YES];
[super viewDidLoad];
[self initNetActivity];
memoryTicker = [[MemoryTicker alloc] initWithResponder:self andMethod:@selector(sizeMemory:)];
memoryTicker.asNumber = YES;
socket = nil;
upstream = nil;}
-(void)doConnect {
resolution = RESOLUTION_CIF;
#if upstream = [[BroadcastStreamClient alloc] init:host resolution:resolution];
//upstream = [[BroadcastStreamClient alloc] initOnlyAudio:hostTextField.text];
//upstream = [[BroadcastStreamClient alloc] initOnlyVideo:hostTextField.text resolution:resolution];
#else
if (!socket) {
socket = [[RTMPClient alloc] init:hostTextField.text];
if (!socket) {
[self showAlert:@"Connection has not be created"];
return;}
[socket spawnSocketThread];}
upstream = [[BroadcastStreamClient alloc] initWithClient:socket resolution:resolution];
#endif
upstream.delegate = self;
upstream.videoCodecId = MP_VIDEO_CODEC_H264;
upstream.audioCodecId = MP_AUDIO_CODEC_AAC;
& here is my Orientation code:
deviceOrientation =
[[UIDevice currentDevice] orientation];
if ( deviceOrientation == UIDeviceOrientationLandscapeLeft )
orientation = AVCaptureVideoOrientationLandscapeRight;
else if ( deviceOrientation == UIDeviceOrientationLandscapeRight )
orientation = AVCaptureVideoOrientationLandscapeLeft;
else orientation = AVCaptureVideoOrientationPortrait;
[upstream setVideoOrientation:orientation];
[upstream stream:stream publishType:PUBLISH_LIVE];
//[upstream stream:streamTextField.text orientation:orientation publishType:PUBLISH_RECORD];
//[upstream stream:streamTextField.text orientation:orientation publishType:PUBLISH_APPEND];
btnConnect.title = @"Disconnect";
[netActivity startAnimating];}
is there a way to solve this problem? thanks