TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Min Kim.
Depends on: | |
librtmp-iOS | ~> 1.0.1 |
IFTimeoutBlock | ~> 1.0.0 |
rtmp-wrapper is a librtmp wrapper library for iOS platform
Source code for the SDK is available on GitHub
$ git clone [email protected]:ifactorylab/rtmp-wrapper.git
Create a Podfile if not exist, add the line below
pod 'rtmp-wrapper', '~> 1.0.6'
#import "RtmpWrapper.h"
RtmpWrapper *rtmp = [[RtmpWrapper alloc] init];
BOOL ret = [rtmp rtmpOpenWithURL:@"YOUR RTMP PUBLISHING POINT" enableWrite:YES];
if (ret) {
NSData *video =
[NSData dataWithContentsOfURL:[NSURL URLWithString:@"FLV VIDEO URL ON THE NET"]];
NSLog(@"original video length: %d", [video length]);
NSUInteger length = [video length];
NSUInteger chunkSize = 10 * 5120;
NSUInteger offset = 0;
// Let's split video to small chunks to publish to media server
do {
NSUInteger thisChunkSize = length - offset > chunkSize ? chunkSize : length - offset;
NSData* chunk = [NSData dataWithBytesNoCopy:(char *)[video bytes] + offset
length:thisChunkSize
freeWhenDone:NO];
offset += thisChunkSize;
// Write new chunk to rtmp server
NSLog(@"%d", [rtmp rtmpWrite:chunk]);
sleep(1);
} while (offset < length);
}
// Close rtmp connection and release class object
[rtmp rtmpClose];
[rtmp release];