I have finally solved my problem.
The point wasn't with the AVPlayer, it was the file storage. Before storing my files locally I encrypt the file and then for playing it I decrypt it.
The problem was that I was saving the files like this:
BOOL success = [encryptedResult writeToFile:path options:NSDataWritingFileProtectionComplete error:&error];
So I couldn't read the files properly when the device is locked, as it says in Apple's documentation.
I've changed everywhere to:
BOOL success = [encryptedResult writeToFile:path options:NSDataWritingFileProtectionNone error:&error];
And it works like a charm.