Is there a way to intercept byte data and perform a XOR operation to each byte prior to playing audio in AVPlayer?
I'm building an audio streaming app and use a little script written in C to add a simple layer of encryption to the MP3 files. In Android it gets decoded in real time like this:
@Override
public int read(byte[] buffer, int offset, int readLength) throws FileDataSourceException {
// ...
if (readLength == 1 && offset >= 1 && offset <= 123) {
buffer[offset] = (byte)(buffer[offset] ^ 11);
}
return bytesRead;
}
}
As you can see above reversing the XOR encryption is fairly easy in Android as I use ExoPlayer and override the read() method in its datasource classes. Is there any chance to perform the same thing using AVPlayer with Swift?
Here's a flowchart of the whole idea:
Thank you.
from iOS: How to intercept and manipulate bytes in AVPlayer
No comments:
Post a Comment