MPMoviePlayerController not playing any video content [due to ARC and memory management]

后端 未结 2 916
礼貌的吻别
礼貌的吻别 2020-12-06 13:21

I am trying to get a video playing in an iOS applocation, using MPMoviePlayerController to append a movie-view to an existing view when a user pushes a button. The view appe

相关标签:
2条回答
  • 2020-12-06 13:58

    Nothing seems obviously out of place to me. Here are some debugging tips to help narrow down the problem:

    • try using a URL to an mp4 file served over http---that should tell you whether it's a UI problem or an asset problem.
    • try inspecting the url for properties such as the file length and confirm that it exactly matches what you expect.
    0 讨论(0)
  • 2020-12-06 13:59

    As with my answer to MPMoviePlayerController playback terminates before video finishes, this looks to be a memory management (instance lifetime) issue. Assuming you are compiling with ARC, the player variable is released when your playButtonClicked: method returns. At that point the MPMoviePlayerController instance takes its bat and ball, and goes home.

    Try assigning the MPMoviePlayerController instance to a strong instance variable or property.

    0 讨论(0)
提交回复
热议问题