0

I can able to play local video, I'm unable to play live video streaming. What I need to do for this. My url is like this...

rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov

My code is:

NSURL *url = [[NSURL alloc] initFileURLWithPath: @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov"];
    NSLog(@"%@", path);
    AVAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
    AVPlayerItem *anItem = [AVPlayerItem playerItemWithAsset:asset];
    dispatch_async(dispatch_get_main_queue(), ^{
        self.avPlayer = [AVPlayer playerWithPlayerItem:anItem];
        [self.avPlayer addObserver:self forKeyPath:@"status" options:0 context:nil];
        self.avPlayerView = [[AVPlayerViewController alloc] init];
        self.avPlayerView.view.frame = self.view.bounds;
        [self.avPlayerView setPlayer:_avPlayer];
        [self.view addSubview:_avPlayerView.view];
    });
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.avPlayer play];
    });

Can any one suggest any code or GitHub link.

Thank you.

Naresh
  • 16,698
  • 6
  • 112
  • 113
  • 2
    Documentation says: _With AVFoundation, you can efficiently load and control the playback of media assets such as QuickTime movies, MP3 audio files, and even audiovisual media served remotely over HTTP Live Streaming._ AFAIK `AVURLAsset` & `AVPlayer` doesn't support RTSP, just HLS. – zrzka Jul 02 '20 at 12:09
  • Does this answer your question? [rtsp:// liveStream with AVPlayer](https://stackoverflow.com/questions/29371400/rtsp-livestream-with-avplayer) – zrzka Jul 02 '20 at 12:10

0 Answers0