How protect music file downloaded by my music app? - ios

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

Related

How to upload video chunks to server and download them in real time in iOS

I'm creating an iOS app where I want a user to be able to live stream a video, however, users who join the live stream after it starts, start watching the stream from the beginning instead of live (I will also add functionality that allows the user watching to skip ahead and then be able to watch live).
I have looked at many third party streaming options such as Agora, Twilio, Vimeo, etc, however, I don't believe they meet my needs as I need users who join the live stream to start watching from the beginning and not live.
I have explored continuously uploading small video chunks to something like firebase storage, and then continuously reading those chunks for users watching the stream. However, as explained here: https://stackoverflow.com/a/37870706/13731318 , this is to very efficient and leads to a substantial lag.
Does anyone have any idea how to go about doing this that leverages third parties?
I think you can use the HLS protocol to implement this.
HLS allows starting to watch from the beginning or not. That is controlled by the settings.
I am not sure about uploading because I think it has to be implemented on the server-side more.

Store videos for an iOS app online or offline?

I am currently working on an iOS app where users can watch several videos (e.g. fitness videos). The videos are all captured by my team, so I don't need access to external videos.
Now my question is, does it make more sense to store the video files offline right in the app or use some kind of online server (and which one would you recommend)? I don't want to embed Youtube videos.
Thanks in advance!
It is always better to go online. Because the size of video may vary and huge video files would scrap user device's memory. SO it is recommended to use an external server to host the video files.
You can also add an option to download the files if needed.

Simplest way to get an audio file from an iOS app into the user's music library without violating app store terms

I'm making an iOS app in which I'd like to allow the user to save an audio file (a specific file that the app uses internally, not just any arbitrary audio file) to their music library so they can play it from other apps on the device. Ideally I'd like to save a sound directly to the users music library, but it seems from other similar questions that this is not possible. File sharing with iTunes seems to be the next best solution.
Is there anything about using the iTunes file sharing option for saving audio in this way that violates the app store terms?
Is this the path of least friction for the user, or is there another way to achieve this that I'm missing?

Accessing iOS music library

I have been programming for iOS for a while. It is simply out of my passion for learning new things. Recently I was trying to access the music files that are transferred to iPhone using iTunes. I could use the mediaPlayer to access them and play the music. I was wondering if there is a way to access the core mp3 files and upload them to a personal server. This is not for an app or something, but just a new learning about iOS.
Thanks in advance,
Videep
You can imagine, for obvious copyright reasons, that you're not allowed to do this. You are able to play it because the owner of the phone owns the song and it's playing for himself, but you are certainly not allowed to upload the mp3 of the whole library of all your customers to your server...

How to implement video DRM in iOS

I'm looking to implement DRM in an iOS video player, but I'm not sure how to implement this. In order to implement video DRM (while still using Apple's hardware accelerated H264 decode), I need a way to feed the decrypted H264 stream into the standard iOS video playback APIs.
According to this question, it was not possible to implement 3rd party DRM in September 2010. There's a thread in the Apple Developer Forums that goes nowhere. However, as of today a number of 3rd party DRM libraries exist: Widevine, Irdeto (PDF), Marlin. They have clearly found some way to pass a custom stream to the media player in Apple approved apps.
I've found two leads. One is a suggestion to create a custom URL protocol, but people seem to have poor success using this with video. The other is to create a local HTTP server thread and provide the content by HTTP live streaming on 127.0.0.1 inside the iDevice. I'd like to be very sure that Apple will approve before going that route.
So - what Apple approved APIs do 3rd party DRM implementations use to get decrypted video data into the video player?
Edit: the latest BBC iPlayer for iOS allows programmes to be downloaded for later viewing. Either they store the content in the clear, or they have cracked this problem.
You can begin decrypting the file into another file and playback that file as you decrypt. You'll need to let it buffer a few seconds worth of video, but it will work.
Additionally you'll need to make sure that the moov atom is BEFORE the mdat atom in the file, otherwise it won't work. (AVFoundation, for example, creates MP4s where the moov atom comes after the mdat atom, and so they would need to be modified to work)
A working solution is local http server. But the patent application was submitted by Authentec.
http://www.google.com/patents/US20120284802

Resources