H264 Playback freeze after SPS changes frame size and aspect ration

I am trying to play H264 video file using AVPlayer.


It works fine as long as video being played out has consistent frame size i.e. video resolution.


I am facing problem in video files where frame size changes.


As soon as player encounters SPS with new framesize and aspect ratio, it freezes the video and conitnue playing audio.


Is there anyway to have AVPlayer work for variable frame sizes defined in SPS?