Results 1 to 2 of 2

Thread: Play stream in IOS app (Check stream before playing)

  1. #1

    Default Play stream in IOS app (Check stream before playing)

    Hello,

    I'm trying to secure the playing a wowza stream on my Ios apps.

    I succeed in playing the stream but the problem is that is don't know how to check if the stream is playing before launching it in my apps. Because if the server is down or the stream is not published there is no error message, the player just stay black.

    I would like to display an error message or to stop the app if the server is down or if the stream is not published.

    I tried to use the notifications :

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayePlayBackDidFinish name:MPMoviePlayerPlaybackDidFinishNotification object:streamPlayer];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayerPlaybackStateDidChange name:MPMoviePlayerPlaybackStateDidChangeNotification object:streamPlayer];

    But none of these one are are fired if the stream is not available.

    Here is my current code :

    NSURL *streamURL = [NSURL URLWithString:@"http://XXX.com:1935/XX/XXX/playlist.m3u8"];
        streamPlayer = [[MPMoviePlayerController alloc] initWithContentURL:streamURL];
        streamPlayer.shouldAutoplay = YES;
        streamPlayer.controlStyle = MPMovieControlStyleNone;
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:streamPlayer];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayerPlaybackStateDidChange:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:streamPlayer];
        
        CGRect streamPlayerFrame = CGRectMake(0, 65, 320, 180);
        [streamPlayer.view setFrame: streamPlayerFrame];
    
        [streamPlayer play];
    Somebody knows how to do that?

    Richard

  2. #2
    Join Date
    May 2013
    Posts
    680

    Default

    One idea would be to create an http provider (on the Wowza side) that you could query from your iOS app that would return true/false if the stream is up. Then you could handle the event as described.

Similar Threads

  1. Can I stream to twitch using the iOS app?
    By Aljones15 in forum Live Streaming and Encoders
    Replies: 4
    Last Post: 04-06-2014, 03:12 PM
  2. Check inside an IOS app if streaming is currently playing
    By ripleyXLR8 in forum Live Streaming and Encoder Discussion
    Replies: 1
    Last Post: 10-21-2013, 06:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •