Question

I am trying to start playing a video file while still being downloaded(i.e. I am trying to emulate buffering.)

My approach:
I maintain a file handle to the video file created.
In – connection:didReceiveData: implementation I append the data received to the video file(I ensure this with seekToEndOfFile).
Once the total data received passes a threshold value, I start playing the file.
Meanwhile I expect – connection:didReceiveData: to keep working the same way as before by appending the data coming in.
This approach is inspired from the following post. http://lists.apple.com/archives/cocoa-dev/2011/Jun/msg00844.html

Result:
Though the author of post above seems to be able to play at least part of the file, in my case the MoviePlayerViewController just shows up on the screen and goes away as though there are no contents in the file.
The code works perfectly fine if I write the whole video data to the file and play once the connection finishes loading.

Has anyone attempted this kind of approach before and succeeded at it?

Était-ce utile?

La solution

Experimented a lot. Don't think it's possible without having a dedicated streaming server https://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html Hence went with a different approach.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top