Tag: media player

iOS Mediaplayer和URLredirect

我试图实现一个MPMedia播放器来播放互联网文件。 到目前为止,我已经设法打开与我主持的video链接的媒体播放器。 当我尝试加载不直接映射到文件的url,而是将其redirect到文件时,问题就开始了。 初始url如下所示:h * tp://www.example.com/ numbers / numbers / numbers 当我把它放在我的浏览器中时,它会自动改变为这样的:h * tp://www.example.com/ numbers .mp4?to = numbers 当我直接使用初始URL时,就像我在直接使用url时一样,播放器出现,并且在不播放video的情况下中断播放。 我已经尝试NSURLConnection获得redirecturl,但我还没有能够得到它的工作,不知何故方法 – 连接:willSendRequest:redirectResponse:不会被调用。 我认为这可能是因为它已经在iOS 5中被删除了,但我不知道任何替代品,而这种问题实际上是没有logging的。 这里是我的代码:(我已经跳过shortUrl初始化,它的工作原理)。 NSLog(@"%@",shortUrl); redirecionando=TRUE; NSURLConnection * conection = [[NSURLConnection alloc]initWithRequest:[NSURLRequest requestWithURL:shortUrl] delegate:self]; [conection start]; while(self.redirecting); self.moviePlayerController = [[MPMoviePlayerViewController alloc] initWithContentURL:finalurl]; moviePlayerController.view.frame = self.view.bounds; [self presentMoviePlayerViewControllerAnimated:moviePlayerController]; moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleFullscreen; moviePlayerController.moviePlayer.shouldAutoplay = YES; [moviePlayerController.moviePlayer […]