The LivePhotosKit JS API is available on NPM.
Code samples are available as part of Apple’s LivePhotosKit JS API reference.
An embeddable web player can be configured with photo and video resources and other options, with developers able to control its behavior and playback programmatically.
Some of the parameters that can be used include the locations of the photo and video components of a Live Photo, whether or not the player will prefetch data before the user attempts to begin playback, if the playback controls are enabled for the user and more.
The player is supported on the following browsers:
- iOS—Safari and Chrome
- macOS—Safari, Chrome and Firefox
- Android (performance depends on device)—Chrome (beta)
- Windows—Chrome, Firefox, Edge and Internet Explorer 11
As Live Photos may take a long time to download, Apple recommends explicitly specifying the height and width of the HTML element being decorated to be a Live Photos player.
“If the photo takes too long, it will not be able to show the progress badge,“ explains the firm. “Downsizing assets will greatly improve performance and reduce bandwidth usage.”
As you know, Live Photos consist of two components—a still photo and a video of the moments 1.5 seconds before and 1.5 seconds after the photo is taken. Live Photos can be captured on iPhone SE, iPhone 6s, iPhone 6s Plus, iPhone 7, iPhone 7 Plus.
Devices supporting viewing Live Photos include iPhone, iPad and iPod touch with iOS 9 or later, Mac models with OS X El Capitan or later and Apple Watch models on watchOS 2 or later.
“In addition to playback, users can share their Live Photos within your app on iOS, macOS and the web,” noted the Cupertino company.
For more information, visit developer.apple.com/live-photos.