gpt4 book ai didi

ios - AVPlayer 不播放没有音频的 HTTP 直播流

转载 作者:行者123 更新时间:2023-11-28 19:04:55 30 4
gpt4 key购买 nike

我有一个正在流式传输实时 HLS 流的 AVPlayer。我正在使用以下代码。

-(void)initPlayer{

self.mPlaybackView = [[AVPlayerPlaybackView alloc] initWithFrame:mPlaybackViewFrame];
[mPlaybackView setVideoFillMode:@"AVLayerVideoGravityResizeAspectFill"];

NSURL *url = [NSURL URLWithString:mCamera.url];
self.playerItem = [AVPlayerItem playerItemWithURL:url];
self.mPlayer = [AVPlayer playerWithPlayerItem:playerItem];

[mPlayer addObserver:self forKeyPath:@"status" options:0 context:AVPlayerPlaybackViewControllerStatusObservationContext];

}

//observer

- (void)observeValueForKeyPath:(NSString*)path ofObject:(id)object change:(NSDictionary*)change context:(void*)context
{

AVPlayer* mPlayer1 = (AVPlayer*)object;
if ([path isEqualToString:@"status"])
{
NSLog(@"Video Player status %i",mPlayer1.status);
if (mPlayer1.status == 2)
{
[self itemDidFinishPlaying];
}
if (mPlayer1.status == AVPlayerStatusReadyToPlay)
{


[mPlaybackView setPlayer:mPlayer];
[mPlayer play];

}
}
}

引用: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html#//apple_ref/doc/uid/TP40010188-CH3-SW1

我的问题

如果其中没有音频 channel ,AVplayer 不会播放我的直播视频。我使用 Wowza 作为我的媒体服务器。直播流是相机提要。我可以毫无问题地播放 AVPlayer 的多个实例(带音频)。

媒体验证器工具响应

VIDEO 1

mediastreamvalidator: Beta Version 1.1(131115)

Validating http://xx.xx.xx.xx/live/127.stream/playlist.m3u8
Validating child playlist chunklist_w101231837.m3u8 [193.55 kbits/sec]

Segment processing interrupted: chunklist_w101231837.m3u8 - 32 out of 32 segments processed...

--------------------------------------------------------------------------------
http://xx.xx.xx.xx/live/127.stream/playlist.m3u8
--------------------------------------------------------------------------------

Playlist Syntax:

Warning: (0:-12274) PROGRAM-ID has been deprecated and is no longer a valid attribute for #EXT-X-STREAM-INF
--> #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=193548,CODECS="avc1.66.41, mp4a.40.2",RESOLUTION=640x480

Alternate playlist(s):

--------------------------------------------------------------------------------
chunklist_w101231837.m3u8
--------------------------------------------------------------------------------

Playlist Syntax: OK

Processed 32 out of 32 segments:

media_w101231837_191.ts:

WARNING: Media segment bandwidth exceeded target playlist bandwidth by 12 % (216.43 kbits/sec vs.193.55 kbits/sec, limit is 10 %).

media_w101231837_192.ts:

WARNING: Media segment bandwidth exceeded target playlist bandwidth by 15 % (221.86 kbits/sec vs.193.55 kbits/sec, limit is 10 %).

media_w101231837_195.ts:

WARNING: Media segment bandwidth exceeded target playlist bandwidth by 15 % (222.77 kbits/sec vs.193.55 kbits/sec, limit is 10 %).

Average segment duration: 9.93 seconds
Playlist target bitrate: 193.55 kbits/sec
Segment bitrate: Average: 189.54 kbits/sec, Max: 222.77 kbits/sec (exceeds target by 15.10 %)
Average segment structural overhead: 13.50 kbits/sec (7.13 %)

最佳答案

我正在使用 Stitched Stream Player在苹果开发者的示例代码中给出..

你能从中得到帮助吗..

关于ios - AVPlayer 不播放没有音频的 HTTP 直播流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21300454/

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