slavavdovichenko / MediaLibDemos

98 stars 25 forks source link

App use with wowza #21

Closed gurkanus closed 10 years ago

gurkanus commented 10 years ago

We are using your application and we are able to run in on DM cloud but wowza servers need four parameters (url, stream address, user name and password) Is there any way to send those parameters to the app? Is there anyone who uses wowza?

slavavdovichenko commented 10 years ago

You use the server url & application name for connecting to the media application, and you can set the additional application options (as user name, password, etc.) in BroadcastStreamClient.parameters property before invoking BroadcastStreamClient stream:publishType: method, for example:

BroadcastStreamClient *_stream = [[BroadcastStreamClient alloc] init:url resolution:resolution]; _stream.delegate = self; [_stream setPreviewLayer:preview]; _stream.parameters = @[@"userName", @"passwd"]; [_stream stream:streamName publishType:(MPMediaPublishType)publishType];

" _stream.parameters" will set "Optional User Arguments" object of RTMP NetConnection command "connect" (see Adobe rtmp specification).

gurkanus commented 10 years ago

Thank you

Narcissuz commented 10 years ago

in project RTMPStreamPublisher

Cannot connect to wowza server with authentication.

My code

-(void)doConnect {

//uint resolution = RESOLUTION_LOW;
//uint resolution = RESOLUTION_CIF;
uint resolution = RESOLUTION_MEDIUM;
//uint resolution = RESOLUTION_VGA;

if 0 // use inside RTMPClient instance

upstream = [[BroadcastStreamClient alloc] initOnlyVideo:hostTextField.text resolution:resolution];
upstream.parameters = @[@"myUsername", @"myPassword"];

else // use outside RTMPClient instance

if (!socket) {
    socket = [[RTMPClient alloc] init:hostTextField.text];
    if (!socket) {
        [self showAlert:@"Socket has not be created"];
        return;
    }

    [socket spawnSocketThread];
}

upstream = [[BroadcastStreamClient alloc] initWithClient:socket resolution:resolution];

endif

//orientation = AVCaptureVideoOrientationPortrait;
//orientation = AVCaptureVideoOrientationPortraitUpsideDown;
//orientation = AVCaptureVideoOrientationLandscapeRight;
orientation = AVCaptureVideoOrientationLandscapeLeft;
//orientation = orientation % AVCaptureVideoOrientationLandscapeLeft + 1;
[upstream setVideoOrientation:orientation];

// [upstream setVideoBitrate:136000];
//[upstream setVideoBitrate:4000];
//[upstream setAudioBitrate:4000];

upstream.delegate = self;

[upstream stream:streamTextField.text publishType:PUBLISH_LIVE];
//[upstream stream:streamTextField.text publishType:PUBLISH_RECORD];
//[upstream stream:streamTextField.text publishType:PUBLISH_APPEND];

btnConnect.title = @"Disconnect";

}

Please advice

gkhnaydn commented 9 years ago

try " [socket connect: serverUrl andParams:@[userName,password]] " to connect to wowza with authentication before publish type line instead of " _stream.parameters = @[@"userName", @"passwd"]; " . maybe it s too late for answer however many people wonder how to connect to the server with authentication and use the params. unfortunately there is no information about this subject, i mean, neither authentication nor params for client side. i hope it will be helpful for authentication.