experimental::ui::VideoPlayer can't play video on iOS 11.3

experimental::ui::VideoPlayer can't play video on iOS 11.3
0.0 0

#1

Hi,
I’m suffering with iOS 11.3.
Because experimental::ui::VideoPlayer can play video on 11.2.x, but not on 11.3.
(It gets COMPLETED callback as soon as playing.)
cocos2d-x’s version is 3.0.1.
Does anybody here know about this problem?
It seems like iOS problem but I want to find the reason.
Please help me.


#2

Please use latest cocos2dx version 3.16 your problem will be slove :slight_smile:


#3

maybe it is a bug in ios 11.3? In file UIVideoPlayer-ios.mm, add code like this:

-(void) videoFinished:(NSNotification *)notification
{
if(_videoPlayer != nullptr)
    {
        //fix : ios 11.3 sends wrong notificaiton here, we need to ignore it
        if ([self.moviePlayer playbackState] == MPMoviePlaybackStatePlaying)
        {
            return;
        }
        
        if([self.moviePlayer playbackState] != MPMoviePlaybackStateStopped)
        {
            _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::COMPLETED);
        }
    }
}