Apple launches JavaScript API for embedding Live Photos on the web

Apple on Thursday announced a new JavaScript-based API for web developers who wish to enable embedding of Live Photos in their websites and web apps. Called LivePhotosKit JS, the new API is in addition to Apple’s current Live Photos API which enables Live Photos on iPhone, iPod touch, iPad and Mac devices and in apps that use it, like Facebook’s mainland mobile appTumblr for iOS and others.

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.

TUTORIAL: How to use Live Photos in Instagram Stories

Developers must include Apple’s LivePhotosKit JavaScript code on their website.

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.

Subscribe to iDownloadBlog on YouTube

“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.

Source: Apple