Pregunta

I am playing a Live Streaming Video in my application using the MPMoviePlayerController. While playing, the screen sometimes goes into black , but I am able to hear the Audio. Why so ? . I tried to get the Notification when the screen goes black, but I am unlucky.

Can anyone tell me why the screen goes black for live streaming ? How to get notified when MPMoviePlayer goes black ?

Please help me !!

¿Fue útil?

Solución

The HTTP Live Streaming overview has this to say.

The data rate that a content provider chooses for a stream is most influenced by the target client platform and the expected network topology. The streaming protocol itself places no limitations on the data rates that can be used. The current implementation has been tested using audio-video streams with data rates as low as 64 Kbps and as high as 3 Mbps to iPhone. Audio-only streams at 64 Kbps are recommended as alternates for delivery over slow cellular connections.

Basically if the network is too slow to stream the video, then an audio-only mode will be used. I can't find a way to get notifications for alternate changes with MPMoviePlayerController. However you can register for the MPMovieMediaTypesAvailableNotification which will allow you to know whether audio/video/both are available (through the movieMediaTypes property).

enum {
   MPMovieMediaTypeMaskNone  = 0,
   MPMovieMediaTypeMaskVideo = 1 << 0,
   MPMovieMediaTypeMaskAudio = 1 << 1
};
typedef NSInteger MPMovieMediaTypeMask;

I'm not completely sure it will notify you when the streaming switches to audio only but you can always try.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top