How to download HLS stream video files and keep in local storage flutter? - flutter

How can I download HLS video files and keep it in local in flutter? I have tried using dio package and flutter_downloader package but not able to download full HLS video files of Playlist.m3u8.
For example,
URL: https://s3.example/samplevideo/playlist.m3u8
This above is the HLS video file URL it contains .ts files so I need to download all the .ts files related to playlist.m3u8 and store it in local.

The .m3u file is a playlist that should contain links of playable media. To download those links, you can use m3u plugin to parse the playlist. From there, you should be able to fetch the list of links that you can use to download the files.

Related

How to get to play an audio file in browser itself rather than downloading from a onedrive shared folder link?

I'm working on a flutter application which uses the shared data from onedrive to play in the app but I'm having trouble getting the m4a file.
For instance, This is a onedrive link: https://1drv.ms/u/s!Aicuq23aphFzb_KQvr0anumY9Jk?e=NQZfXl. Now, I converted it to an api as given in here and I got this URL.
When I browse children.#content.downloadUrl I see a link which is a download link but I want a link with m4a file that will play in the browser itself. How am I suppose to achieve that ?
You will need an audio playing service in your app which can take an URL and play it for you handling all the internals like downloading, buffering etc.
Checkout this package: audio_service

AVPlayer, Play a local file URL that is currently being written to?

I have been trying to use a custom AVPlayerItem that lets me copy the currently playing media to file after it has been downloaded while it is streaming into the AVPlayer, essentially letting me cache the displayed video while showing the video as soon as possible.
Unfortunately, my application sometimes needs to download mp4 files from a server (that I don't control) that is giving the mime type as image/gif although the downloaded file IS an mp4 file. Because of this, my AVPlayer is not "streaming" in the video as it's downloaded, and only shows it once the file is completely downloaded and it realizes the file really is an MP4.
My thought is now to just download the file directly to a local file with a .mp4 extension that a standard AVPlayerItem can stream in, and write to this file while reading from it with the AVPlayerItem. Is this possible? Will the AVPlayerItem pause when it is still downloading/buffering the incomplete data or will it just produce an error without displaying anything? Is there a better way I can be doing this?

Downloading audio file from google drive and playing

I have uploaded audio from my app into google drive.Now I want to download the audio file and also play the audio while it is getting downloaded into application.
Thanks
Query File.list() with restriction on filetype
Find webContentLink from Files resource. You'll get HTTP link for file
There are many libraries to stream audio/video with HTTP in iOS
If you are new to Drive API, check iOS quickstart

Titanium Saving the Recorded Audio Files in a folder, Uploading audio files to Web Server,

How to save the file which is recorded in sound_record.js File from Appcellrator Titanium KitchenSick Demo.
file = recording.stop(); // file container TiFile Object
sound = Titanium.Media.createSound({sound:file}); // Sound Contains. TiMedia Object
I found these two lines which has the data, which is recorded, But i didnt get that, How to save these recorded data into iphone, so that they can have an access to these files which is recorded.
And also Uploading the Audio files to Web Server, Every where we have how to upload the Image which comes from Gallery, But there is no where its mentioned how we can upload the audio files such as .wav file which is recorded using sound_record.js.
I would checkout the KitchenSink, you'll find a lot of examples there. For saving I would checkout the filesystem.js and for upload the xhr_fileupload.js.

MPMoviePlayerController & .m3u8 playlist

I would like to use a .m3u8 playlist containing remote mp4 files with MPMoviePlayerController, did you success with this ?
Does the .m3u8 must contain .ts file ?If not what is the purpose of .ts ?
Does next / previous buttons will be enable once the playlist be loaded ?
If not, what is the purpose of these buttons ?
And last question, do you have a .m3u8 sample file with remote mp4 file to test ?
Thanks a lot for your help.
Thierry
Since you're talking about .m3u8 and .ts files, can I assume you're interested in HTTP Live Streaming, as supported by iPhone OS 3.0 and Snow Leopard? There is more info about HTTP Live Streaming in the documentation.
In HTTP Live Streaming, the .m3u8 file lists other files that are to be downloaded and played in order. If the .m3u8 file doesn't contain an #EXT-X-ENDLIST directive, then the client assumes the source is a live stream, and periodically re-fetches the .m3u8 to find new media files to download. The .ts files are MPEG-2 trasnsport stream files that contain muxed audio and video (despite the fact that the transport stream is part of the MPEG-2 spec, the contents should be H.264 and AAC, the audio and video codecs usually associated with MPEG-4). You sometimes see other contents, like .aac for audio-only streams. A server will segment a video stream into many .ts files, the .m3u8 file will provide URLs for these .ts files, and a client will download and play the .ts files in order. As an iPhone developer, all you have to do is provide the .m3u8 URL to the MPMoviePlayerController, which will handle the rest.
Don't know about the prev/next buttons... don't seem like they'd make sense in a stream context, and I'm not sure whether the the MPMoviePlayerController even shows them. You can use the movieControlMode property to set what controls are offered to the user.
Apple's docs provide links to some sample test pattern streams.