App crash in ios due to MPMoviePlayerViewController

173 views Asked by At

My Code

In my Video Player App that plays online streaming videos.So i used

XCDYouTubeKit

This Plays Video with reference of MPMoviePlayerViewController. When First Video is Playing and i clicked on other it gives me error and crash my app.

At line number 1094 i got the following error.

movie player MPMoviePlayerControllerNew: 0x13f0a1f10 has wrong activation state (1)

2

There are 2 answers

2
DHEERAJ On

I think this is based on memory issue.

When you are initing the movie player, you already have one. There can be only one MPMoviePlayerController. You are probably doing this in a loop. You need to set your last movie player object to nil or keep reusing the same one over and over.

0
Rukshan On

This usually happens when you have more than one MPMoviePlayerController instantiated. You can play one video with MPMoviePlayerController at once.

From Apple's doc,

NOTE

Although you can create multiple MPMoviePlayerController objects and present their views in your interface, only one movie player at a time can play its movie.

source : MPMoviePlayerController Class Reference