我在播放“视频”声音时遇到问题。
我遵循所有标准,但视频/音频有时会静音或在视频文件末尾消失。我不知道为什么。有谁知道可能是什么问题?
这只发生在真实设备上运行应用程序时,我无法在模拟器上重现该问题。
“didReceiveMemory”警告会导致这种情况吗?当它发生时,我有时会收到此消息。
视频文件通过 URL 地址进行流式传输,格式为 MPEG-4 电影,大小小于 6.2 MB。
我有以下代码:
- (IBAction) playMovie:(NSString*)theUrl
setMovieType:(NSString *)theType
setPlayOption:(int)theOption
setSenderUIButton:(UIButton *) thisSender
{
NSString *getvdoUrl = [[NSString alloc] initWithString:theUrl];
NSURL *thisVdoURL = [NSURL URLWithString:getvdoUrl];
[getvdoUrl release];
getvdoUrl = nil;
MPMoviePlayerController *movieplayer = [[MPMoviePlayerController alloc]
initWithContentURL:thisVdoURL];
thisVdoURL = nil;
if (movieplayer)
{
self.vdoPlayer = movieplayer;
[movieplayer release];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.vdoPlayer];
[self.vdoPlayer play];
}
}
-(void) moviePlayBackDidFinish:(NSNotification*)theNotification
{
MPMoviePlayerController *movieplayer= [theNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:movieplayer];
movieplayer.initialPlaybackTime = 0.0;
[movieplayer stop];
}
以下是警告信息。我在视频文件开始播放之前收到了它们:
warning: Unable to read symbols for
"/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.3
(7E18)/Symbols/System/Library/VideoDecoders/VCH263.videodecoder"
(file not found).
warning: Unable to read symbols for
"/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.3
(7E18)/Symbols/System/Library/VideoDecoders/H264H1.videodecoder"
(file not found).
warning: Unable to read symbols for
"/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1.3
(7E18)/Symbols/System/Library/VideoDecoders/MP4VH1.videodecoder"
(file not found).
2010-03-29 16:57:25.830 ....
v2[4663:207] setting
file:///private/var/mobile/Applications/7DCB1FCC-7268-4551-B737-8B418CA4A07E/tmp/MediaCache/[html]