Search code examples
videowatchos-2wkinterfaceobject

How to loop video in watchOS 2?


How do you loop a watchOS 2 video so it plays over and over forever?

All I have right now is the video playing once. What code should I add to change that?


Solution

  • You can loop a WKInterfaceMovie by setting setLoops to YES/true.

    Sets a Boolean value indicating whether the movie plays in a continuous loop. Specify YES to play the movie in a continuous loop or NO to play the movie once and then stop playback.

    Swift sample code:

    @IBOutlet weak var moviePlayer: WKInterfaceMovie!
    ...
    moviePlayer.setLoops(true)