Search code examples
iosvideo-streamingvideo-capturertmpvideocore

how can we give random stream name (in url) for a stream for RTMP and Videocore


I am making app code which is working for RTMP server (Wowza Server) and video core Lib. I am giving RTMP Stream url like below

[_session startRtmpSessionWithURL:@"rtmp://"andStreamKey:@"Something"];

Now I want to give the random values for rtmp stream. If I enter a random stream name (in url) for a stream which doesn't exist, it lets me connect and stream. How can I do this? how can get the url from my server that is php then i will play that video on wowza server based on that URL is it possible to send the video while capturing every frame


Solution

  • You can create a function like this:

    -(NSString *)createRandomURLStreamName
    {
        NSTimeInterval timeStamp = [ [ NSDate date ] timeIntervalSince1970 ];
        NSString *randomURL = [ NSString stringWithFormat:@"M%f", timeStamp];
        randomURL = [ randomURL stringByReplacingOccurrencesOfString:@"." withString:@"" ];
        return randomURL ;
    }
    

    this will be unique everytime as its uses timestamp.