Hi all,
I am newbie to Wowza. I am trying to upload the stream to Wowza server using rtmp protocol.
here is my Java code :
public void uploadStream( IClient client, RequestFunction function, AMFDataList params ) throws IOException
{
WMSLogger log = getLogger();
log.info( "WMSLogger ");
String streamName = params.getString(PARAM1);
log.info( "streamName : "+streamName);
BASE64Decoder decoder = new BASE64Decoder();
byte[] decodedBytes = decoder.decodeBuffer(streamName);
IVHost vhost = VHostSingleton.getInstance(VHost.VHOST_DEFAULT);
Publisher publisher = Publisher.createInstance(vhost, “ios”);
publisher.setFileExtension(“mp4”);
publisher.setStreamType(“live”);
publisher.publish(“myStream1”, “append”);
AMFPacket amfPacket = new AMFPacket();
amfPacket.addData(decodedBytes, amfPacket.getSize(), decodedBytes.length);
publisher.addVideoData(amfPacket.getData(), amfPacket.getSize(), amfPacket.getTimecode());
log.info( "publisher.getFileExtension : "+publisher.getFileExtension());
String streamName1 = params.getString(PARAM1);
String fileName = “”;
IApplicationInstance appInstance = client.getAppInstance();
MediaStreamMap streams = appInstance.getStreams();
IMediaStream stream = streams.getStream(streamName1);
if (stream != null)
{
log.info(“stram is not empty”);
}
}
Application.xml
true
live
${com.wowza.wms.context.VHostConfigHome}/content
${com.wowza.wms.context.VHostConfigHome}/keys
cupertinostreamingpacketizer,smoothstreamingpacketizer,sanjosestreamingpacketizer
MidRoll
mp4:Extremists.m4v
FeatureBreak
10000
Integer
forceInterleaved
true
Boolean
cupertinostreaming,smoothstreaming,sanjosestreaming
-1
*
*
*
*
digest
none
senderreport
12000
75
90000
0
0.0.0.0
127.0.0.1
*
My Module
This is My IPhoneWowzaStreamServer
com.wowza.iphone.IPhoneWowzaModule
And here are the server logs:
INFO session connect 0:0:0:0:0:0:0:1%0 -
INFO server comment - WMSLogger
INFO server comment - streamName : AAAAGGZ0eXBNNFYgAAACAGlzb21pc28yAAAACGZyZWUAAB50bWRhdAAAAbMAEAcAAAG2EGCxgpm38bbfxtt/G238bbfxtt/G2
INFO stream create - -
INFO stream publish myStream1 -
INFO stream record myStream1 -
INFO stream recordstop myStream1 -
INFO server comment - LiveStreamPacketizerSanJose.init[ios/definst/myStream1]: chunkDurationTarget: 10000
INFO server comment - LiveStreamPacketizerSanJose.init[ios/definst/myStream1]: chunkDurationTolerance: 500
INFO stream unpublish myStream1 -
INFO server comment - LiveStreamPacketizerSanJose.init[ios/definst/myStream1]: playlistChunkCount:4
INFO stream destroy myStream1 -
INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: sanjosestreamingpacketizer:myStream1
INFO server comment - stream : null
INFO server comment - LiveStreamPacketizerCupertino.init[ios/definst/myStream1]: chunkDurationTarget: 10000
INFO server comment - LiveStreamPacketizerCupertino.init[ios/definst/myStream1]: chunkDurationTolerance: 500
INFO server comment - SanJosePacketHandler.startStream[ios/definst/myStream1]
INFO server comment - LiveStreamPacketizerCupertino.init[ios/definst/myStream1]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[ios/definst/myStream1]: playlistChunkCount:3
INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: cupertinostreamingpacketizer:myStream1
INFO server comment - CupertinoPacketHandler.startStream[ios/definst/myStream1]
INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: smoothstreamingpacketizer:myStream1
INFO server comment - SanJosePacketHandler.resetStream[ios/definst/myStream1]
INFO server comment - CupertinoPacketHandler.resetStream[ios/definst/myStream1]
INFO server comment - LiveStreamPacketizerSmoothStreaming.startStream[ios/definst/myStream1]
INFO server comment - LiveStreamPacketizerSmoothStreaming.resetStream[ios/definst/myStream1]
INFO server comment - MediaStreamMap.removeLiveStreamPacketizer[ios/definst/myStream1]: Destroy live stream packetizer: smoothstreamingpacketizer
INFO server comment - MediaStreamMap.removeLiveStreamPacketizer[ios/definst/myStream1]: Destroy live stream packetizer: cupertinostreamingpacketizer
INFO server comment - MediaStreamMap.removeLiveStreamPacketizer[ios/definst/myStream1]: Destroy live stream packetizer: sanjosestreamingpacketizer
iPhone-code:
NSString *method = [NSString stringWithString:@“uploadStream”];
NSString*pt = [[NSBundle mainBundle] pathForResource:@“Screen Recording 17” ofType:@“mp4”];
NSMutableData *videoData = [NSMutableData dataWithData:[NSData dataWithContentsOfFile:pt]];
NSMutableData *stringData = [NSMutableData dataWithData:[@“Screen Recording 17” dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"%d",stringData.length);
Base64Transcoder *base64Transcoder = [[Base64Transcoder alloc] init];
NSString *base64String = [[base64Transcoder base64EncodedStringfromData:videoData
WithNewLineValidation:[NSNumber numberWithBool:YES]] copy];
// [args addObject:@“helloegkjvdsfnvkeljsnfbvekjrnbverggjknefnvkeljsnfbvekjrnbjkkerttrtnfgnregjknerkgjenrgkjerngkjsdasd”];
for (int length = 0; length < [base64String lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; length++) {
NSMutableArray *args = [NSMutableArray array];
int offset = length;
length = length+97;
[args addObject:[base64String substringWithRange:NSMakeRange(offset,length)]];
// NSLog(@“invoke : %@ %d”,args, length);
[socket invoke:method withArgs:args];
args = nil;
sleep(4);
}
But the streams are not getting publish.
Thanks in advance