My iOS app downloading encrypted mp4 file from server to my document folder.
I'll decrypt mp4 to my Memory and play video from memory.
For security, my app should not make decrypted mp4 file to doc folder.
How can I play Video from memorystream?
I'm trying with FFMpeg..or is there any other solutions?
Can I customize avio_open2() and avformat_open_input()?
Please help me....
Set AVFormatContext->pb to a self-created AVIOContext that wraps your memory stream. Most important are the read_packet() and seek() function callbacks, which your application should implement to do actual packet reading and seeking for the (mp4) demuxer. You can also look at earlier questions along the same path.
Related
I am need a solution for protect music file downloaded in an music app.
We have all rights for the audios, so, we need to garante only our app is able to play this audios.
This music app actually is only for streaming. The next update is for implement the functionality for download e play music offline.
I know Spotify , for example, use DRM protection, but it is a little bit controvercious for some people, and I think this is not what we need now.
During my researches, I dont find any concrete solution. So, my questions are which functionalities, libraries or resources can I use to protect the downloaded files.
Maybe I need to encrypt/decrypt the files? But, Swift have a native functionality for this, and have some documentation available?
So, what can I use to protect the audios with Swift, and keep playing the audio only in my own app?
This question gets asked almost daily and the answer is, and will always be, the same - if a user can play your audio on their device, then they can also extract and keep a copy of that audio - no amount of DRM, encryption or any other naive concept anyone dreams up can change this.
You can prevent "script kiddies" from just copying the files off their phone by embedding an encryption key in your app and streaming files through a stream cipher before playing them, but again, it's trivial to reverse engineer and get the key.
You can transcode your .mp3 files to HLS file which will generate one master playlist and several segment files and then you can apply ALS encryption on it using ffmpeg or Apple Media segmenter.
For More Info:
https://www.theoplayer.com/blog/content-protection-for-hls-with-aes-128-encryption
Currently in our iOS Application, we are downloading the video and then playing it, which is indeed taking a lot of time and killing the user experience. Now, we want to shift to directly stream the video or play the video while it is downloading.
I have tried using AVAssetResourceLoaderDelegate. I doesn't play the video at all and displays the mime type as text/html. Maybe because I am loading from a secured URL with headers.
Can someone suggest me a good way where I can stream or Play the video while downloading it. Would be glad if someone suggest a way to Stream the video's directly from the URL.
I'm not sure whether this question is eligible to ask in this forum. I just want to know how the video streaming applications like,
Hotstar
Youtube
Spuul
and all developed a downloading manager which handle a video downloading process smoothy. How can we develop the same in my application? What are all the things i need to check for developing this? How should i develop it properly?
Any suggestions?
There now exists a Chrome extension which unites segments from m3u8 list and combines them in a video which then is saved to your computer.
Here's the link HLS Video Saver.
Your best shot is HLS. Segment your video file on server side with lets say
apple segmenter. Then create m3u8 playlist with these files. Next open the playlist file with the media player of your choice.
I have a remote MP4 file that has video and sound. I want to only stream the audio track of the mp4 file. I don't need the video and want to decrease the internet usage in my app. I have no idea where to start with this, Google doesn't seem to help. Is this impossible? Any ideas?
You can't... If you want audio only, you need to split video / audio on the server or put a stream software (like vlc, ffmpeg or mplayer) who can re-encode file in realtime (so you can drop video for new stream)
It's better, for me, to process all files on server and extract audio track...
We've got an app we're working on that needs to provide playback of video files via AVPlayer. The files need to be stored on the user's device, but also must playback while downloading.
At the moment we've built a download module that uses the ASIHTTPRequest library to get the video files via PHP (we don't want the media to be linkable via public URLs) and write them to disk asynchronously.
We've then setup an AVPlayer as per the AV Foundation Programming Guide, getting the file with AVURLAsset, making an AVPlayerItem with the asset, building the AVPlayer with the item, then setting the player to an AVPlayerLayer. The player runs fine with a fully downloaded video file and will also run a progressively downloaded file perfectly well in the simulator.
Unfortunately on an actual device, the behavior of the player changes, where instead it seemingly loads the video once and doesn't attempt to grab new packets from disk. The result is that the player will play video and audio up to the point in the video that marks where the download progress was at the time the asset was loaded (e.g. if 2MB of data are buffered then the player is created, the player will only play up to the 2MB worth of data). Because it has the video's header, the player will happily continue thinking it's playing for the full duration of the video, but no other video is rendered to screen.
The last wrinkle is that if the video is inserted into an AVComposition and the AVPlayer is created with that, the progressive video will play fine. This would be a fine solution (and is necessary for our app anyway on occasion) except that the client for our app requires that the video be playable on an Apple TV via AirPlay, which AVCompositions are incapable of.
Does anyone know if there is a way to play progressively downloading video files using an AVPlayer built from AVURLAssets? Is there a way to force the player/playerItem to read from disk with an AVURLAsset the way it seems to do with an AVComposition instead of seemingly caching the video in memory?
Thanks!
I haven't a solution to just make it work wit AVURLAssets but I use a slightly different approach. We bundle our App with CocoaHTTPServer and play video files which aren't fully downloaded trough a HTTP request against the local server.
The server knows the total length of the file and can then decide by looking at the HTTP-Headers which part of the file is request and either loads it from disk or from remote source.
While developing this there where always 3 initial requests, one for the first two bytes of the file, one of a larger chunk from the beginning of the file and one chunk directly of the end of the file. That's why it was always needed to load at least the last part directly from the remote server since the player would need it right from the start. I would guess the same happens for local files so the player loads the last bytes from the file (which aren't the right last bytes) and won't play over that length.
You would have to subclass HTTPConnection and make your own HTTPResponse class by looking at the provided "HTTPAsyncFileResponse".
I hope this gives you an idea how to accomplish this with a different approach.