# video search on "cats"curl --location --max-time 1 --request GET 'https://api.giphy.com/v1 /clips/search?api_key={API_KEY}&q=cats&limit=5'
# first 10 trending videoscurl --location --max-time 1 --request GET 'https://api.giphy.com/v1 /clips/trending?api_key={API_KEY}&limit=10'
You can use a standard video element available in browsers to play a Clip. Fetch a Clip URL from one of the renditions returned in the videos object and instantiate the <video> component as follows:
<video src="some-giphy-rendition.mp4" autoPlay loop/>
The iOS SDK repo contains a Clips-specific sample project which showcases technical solutions playing back Clips in a UICollectionView. While this project features the SDK’s UI for discovering and searching for Clips, the video components used for playback in the UICollectionView are unreliant on the SDK and may serve as a useful resource for partners powering their integration with the GIPHY API.
Playing back a Clips video asset in your iOS app is easy thanks to Apple’s native APIs.
We recommend using the AVFoundation framework, including the AVPlayer, AVPlayerItem, AVPlayerLayer, AVQueuePlayer, and AVPlayerLooper components to support looping video playback.
Instantiate a player item with a Clips video asset url like so:
let playerItem = AVPlayerItem(url: url)
Create an AVQueuePlayer and AVPlayerLooper to take care of automatic looping.
let videoPlayer = AVQueuePlayer(items: [playerItem])
let playerLooper = AVPlayerLooper(player: videoPlayer, templateItem: playerItem)
Then, all that’s necessary is to set your AVQueuePlayer into the .player property of an AVPlayerLayer. Apple provides a useful code sample for setting up a simple Video Player View here.
Similar to iOS, we have made source code for our looping video components available in the Android SDK repository. Learn more here and access the sample code here.
Playing back a Clips video asset in your Android app is best achieved with Google’s ExoPlayer, an application-level media player for Android. We recommend using ExoPlayer over Android MediaPlayer. And here is why:
MediaPlayer does not support smooth streaming
Exoplayer Supports caching out-of-the-box.
MediaPlayer is less customizable as compared to ExoPlayer.
The steps to get started with Exoplayer are described here:
Hello world! - ExoPlayer