Playing Movies from ITunes using MPMoviePlayerCont

2019-05-01 04:34发布

问题:

I'm trying to play a movie acquired from iTunes. The movie was placed in my sandbox via File Sharing/iTunes Transfer. The application is using MPMoviePlayerController or MPMoviePlayerViewController. I can use either, but neither have work properly on an iTunes movie.

Below is what I am observing:

  • Test Movie

    • Acquired from Hillegass (Chapter 20) - OK [1]
    • Acquired from Apple's sample - OK [2]
    • Apple Video app - OK
  • iTunes Movie

    • No video
    • No audio
    • Silent failure in my application [3]
    • Silent failure in Hillegass' sample [3]
    • Silent failure in Apple's sample [3]
    • Apple Video app - OK

When the view is launched, I get a black screen and the PLAY button is available. Tapping PLAY causes the player to attempt the operation, but it fails (?) and the PLAY button is shown again.

Checking the state of the movie controller shows it is Ready. When PLAY is tapped, the state goes to Playing and then immediately to paused. Trying to PLAY again repeats the cycle.

During the Ready → Playing → Paused transitions, I do not get a finished notification, and I do not get an error from other notifications.

I thought orientation might be the issue, but rotating or changing the orientation mode crashes Xcode.

Apple's documentation does not mention anything special for iTunes movies, protected content, or DRM (perhaps I missed a relevant document). It seems like a moot point, since the movie was purchased from iTunes, the device is authorized (all under the same account), and I am the licensee.

For what its worth, NSZombieEnabled is YES, so I don't believe I am smashing memory (memory errors are probably not present in Apple's and Hillegass' samples).

Any ideas on what I might be doing wrong or how I should play an iTunes movie I purchased?


References

[1] http://www.bignerdranch.com/book/iphone_programming_the_big_nerd_ranch_guide

[2] http://developer.apple.com/library/ios/#samplecode/MoviePlayer_iPhone/Introduction/Intro.html

[3] http://www.apple.com/itunes/charts/tv-shows/the-simpsons/lost-verizon/

回答1:

The DRM protection is the problem.

Apple does not allow playing DRM protected music or videos from iTunes in the MPMoviePlayerController (which includes the previews).

Please also see following link on Stackoverflow

Regarding the crash: You may post some code.