Streaming .m3u8 using MPMoviePlayerController does not work
You've specified your url incorrectly. Change it to this:
url = NSURL(string:path)
MPMoviePlayerController not refreshing or accessing m3u8 on Live HTTP Streaming
Just solved it: It simply works in the device, but not on the simulator. I have no clue why.
It also doesn't care if you implement it through html5 or through MPMoviePlayerController, the behavior is the same.
I hope it helps someone in the future.
MPmovieplayer and streaming m3u8 file?
m3u8
is a playlist file. It has links to either other playlist files or video files in TS
(transport stream) format. The ts
files are most commonly 10 seconds chunks of video. So, every N(10) seconds it fetches a new stream.So, when you seek, it will go and fetch the stream that had that chunk of the video. So, you will see buffering again.
Playing Stream .m3u8 Audio File in iOS
MPMoviePlayerController
lets you start playing, stopping and streaming of the content, which is meant to be incorporated into your own view hierarchy.
Since iOS 3.2 MPMoviePlayerViewController
became available, which handles the presentation for you.
In your code above, for the first case, it is not added to the view hierarchy.
Ex:
[self.view addSubview:player.view];
Another difference is MPMoviePlayerController
is a property of MPMoviePlayerViewController
.
Think of MPMoviePlayerController
as a player that gives you the controls andMPMoviePlayerViewController
provides you, in addition to controls, also the presentation.
Hope this helps.
IOS - Live streaming using MPMoviePlayerController losing video but not audio
This is how HTTP live streaming is designed to work. It will progressively choose higher or lower quality streams based on the strength of the internet connection. If the connection is not fast enough the "last resort" is to continue to play audio but no video. The only way to recover the video image in this case is to improve the speed of the internet connection.
iPhone MPMoviePlayerController : download files while streaming en play them locally
.m3u8 is Apple HTTP Live Streaming, right? I think what you're trying to do simply goes against the design of that technology. You should expose the original file and allow it to be downloaded.
From what I understand, it's in the design of streaming that you don't get explicit access to the pieces in order to put them back together. For instance, Netflix uses streaming via Silverlight, and one of the benefits (to Netflix) is that it protects the data from being saved as if it were downloaded. Also, since HTTP Live Streaming allows a stream to switch bitrates on the fly, it's designed such that each time slice can be encoded at any number of bitrates, and none of them is canonical.
In theory, there might be a way to collect all the slices for a particular bitrate and re-encode them into a single video. But Apple's playback APIs are not going to give you that opportunity.
Instead of HTTP Live Streaming, consider progressive download. Just serve the original video file (transcode it to something the iPhone likes if necessary). If your server is configured properly, the playback APIs will do small requests to get particular chunks of the file, rather than the whole thing in one go, and it's a close second to proper streaming. I wish I could find where I read about this so I could give the proper name for it. Amazon S3 is set up to serve this way, if you need a quick solution.
But beware, Apple's docs say,
If your app delivers video over
cellular networks, and the video
exceeds either 10 minutes duration or
5 MB of data in a five minute period,
you are required to use HTTP Live
Streaming. (Progressive download may
be used for smaller clips.)
Related Topics
How to Read a File from The Filesystem in a Swift Command Line App
Macos Swift UI View Where There Is a Search Field in The Title Bar
Prevent Nscollectionview 'Lifting' an Item During Drag
How to Use The Spritekit Method Body(At: Cgpoint)
Animation Triggered Using a Button Stops a Repeatforever Animation Added Onappear
How to Check for Self with Contains() in Swift
Getting an Ip Address and Port Number from a Sockaddr_In Struct in Swift
Validate Unicode Code Point in Swift
How to Pass Data Backwards to a View Controller After Passing Forward
Why Do I Keep Getting The Error "No Such Module 'Realmswift'"
Midiclientcreate Does Not Work for 32 Bit Processors in Swift
Display Array in a Label in Swift
How to Count Number of Sprites Swift
Using UIscrollview Correctly in Swiftui
Must Call a Designated Initializer of The Superclass 'Day' Error