gpt4 book ai didi

iphone - 在iPhone中播放视频网址

转载 作者:行者123 更新时间:2023-12-01 19:23:12 24 4
gpt4 key购买 nike

如何在Iphone中播放服务器URL视频?
如何使用MPMoviePlayer从url播放视频?

 (void)loadVideo {

videoUrl = [NSURL URLWithString:[NSString stringWithFormat:@"http://movies.apple.com/media/us/mac/getamac/2009/apple-mvp-biohazard_suit-us-20090419_480x272.mov"]];
if(videoUrl) {

if([videoUrl scheme]) {

[self playVideoStream:videoUrl];
}
}
}

-(void)playVideoStream:(NSURL *)movieFileURL {

MPMovieSourceType movieSourceType = MPMovieSourceTypeUnknown;
/* If we have a streaming url then specify the movie source type. */
if ([[movieFileURL pathExtension] compare:@"mov" options:NSCaseInsensitiveSearch] == NSOrderedSame)
{
movieSourceType = MPMovieSourceTypeStreaming;
}
[self createAndPlayMovieForURL:movieFileURL sourceType:movieSourceType];
}

-(void)createAndPlayMovieForURL:(NSURL *)movieURL sourceType:(MPMovieSourceType)sourceType {

/* Play the video! */
[moviePlayer setMovieSourceType:sourceType];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];;
moviePlayer.view.frame = CGRectMake(10, 20, 280, 210);
[customVideoView addSubview:moviePlayer.view];
[moviePlayer play];
}

最佳答案

您需要在第一个

moviePlayer.contentURL = urlVideo;

[moviePlayer prepareToPlay];
[moviePlayer play];
设置 contentURL属性

关于iphone - 在iPhone中播放视频网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9175382/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com