I want to play video (.mp4 format) in background continuously(on loop). I tried using the MediaPlayer,AVFoundation but i didn't get the desired result.

I used another method after converting mp4 to gif, .gif worked for me but the quality was low. So please help me find the best method to solve my problem.