Svrf API Docs

Media

SvrfMedia

A SvrfMedia class contains the metadata and files for Media from the Svrf API.

Declaration

class SvrfMedia {
let adult: Bool?
let authors: [String]?
let canonical: String?
let description: String?
let duration: Double?
let embedHtml: String?
let embedUrl: String?
let files: SvrfMediaFiles?
let height: Double?
let id: String?
let metadata: SvrfMediaMetadata?
let site: String?
let title: String?
let type: SvrfMediaType?
let url: String?
let width: Double?
}

Properties

PropertyDescription
idThe unique ID of this Media.
titleThe title of the Media, suitable for displaying.
descriptionA description of the Media.
authorsThe Media's authors. This should be displayed when possible.
siteThe site that this Media came from. This should be displayed when possible.
canonicalThe canonical page this Media can be found at via Svrf.
urlThe original page this Media is located at.
embedUrlA player that can be embedded using an <iframe> tag to play the Media.
embedHtmlAn <iframe> tag that embeds a player that plays the Media.
typeSee SvrfMediaType. The type of the Media. This should influence the media controls displayed to the user.
adultWhether the Media is adult content.
widthThe width, in pixels, of the Media's source.
heightThe height, in pixels, of the Media's source.
durationThe duration of the Media in seconds.
metadataSee SvrfMediaMetadata.
filesSee SvrfMediaFiles.

SvrfMediaMetadata

Metadata about the Media.

Declaration

class SvrfMediaMetadata {
let isFaceFilter: Bool?
let hasBlendShapes: Bool?
let requiresBlendShapes: Bool?
}

Properties

PropertyDescription
isFaceFilterFor 3D Media, denotes that this model can be applied as a face filter overlay on a video of a face.
hasBlendShapesFor 3D Media, denotes that this model contains blend shapes, but having to calculate and apply weights to them is not required. These are models like glasses, hats, and billboards that do not react to face movement.
requiresBlendShapesFor 3D Media, denotes that calculating and applying blend shape weights to this model is required for the correct experience. If your platform cannot detect and calculate blend shape weights you MUST NOT present these models to your users.

SvrfMediaFiles

Various sizes of images and resolutions for the SvrfMedia. They will never be larger than the SvrfMedia source's original resolution.

Declaration

class SvrfMediaFiles {
var glb: String?
var glbDraco: String?
var gltf: [String:String]?
var images: SvrfMediaImages?
var : SvrfMediaStereo?
var videos: SvrfMediaVideos?
}

Properties

PropertyDescription
gltfA map of file names to URLs where those files are hosted. The file names are relative and their name hierarchy should be respected when saving them locally.
glbThis is the binary glTF format that should be used by clients if the Media is a 3D object. This is the preferred format to use on end-user devices.
glb-dracoThis is the binary glTF format, with additional DRACO compression, that should be used by clients if the Media is a 3D object. Your renderer must support the KHR_draco_mesh_compression extension to use this model.
imagesSee SvrfMediaImages.
stereoSee SvrfMediaStereo.
videosSee SvrfMediaVideos.

SvrfMediaImages

Resized jpeg stills of the Media. For video these will be stills from 1/3 of the video's duration. Resolutions larger than the original size will not be included (the original is included as max). For stereoscopic content, this will be a monoscopic version of the top or left channel.

Declaration

class SvrfMediaImages: Codable {
let _136: String?
let _540: String?
let _720: String?
let _1080: String?
let _4096: String?
let _8192: String?
let _1080Watermarked: String?
let _720x405: String?
let _720x540: String?
let _720x720: String?
let max: String?
}

Properties

PropertyDescription
_136136px wide image. This image may be used for thumbnailing.
_540540px wide image. This image may be used for thumbnailing.
_720720px wide image. This image may be used for thumbnailing.
_10801080px wide image. This image should be used for previews or other uses requiring clear resolution at low bandwidth.
_40964096px wide image. This image should be used on mobile devices, as larger images may cause some devices to crash.
_8192The image at a reasonably large resolution that can be used for a better desktop experience.
_1080Watermarked1080px wide watermarked image. This image should be used for sharing on social media.
_720x405A 16:9 image. This image may be used for thumbnailing.
_720x540A 4:3 image. This image may be used for thumbnailing.
_720x720A 1:1 image. This image may be used for thumbnailing.
maxThe image in its largest available size (the original size). This image should be used in third-party applications for the best experience, except on mobile devices (see _4096).

SvrfMediaStereo

Resized versions of the Media, matching the Media's type, in stereoscopic. Only included if the Media is stereoscopic. Resolutions larger than the original size will not be included (the original is included as max).

Declaration

class SvrfMediaStereo {
let _848: String?
let _1440: String?
let _2160: String?
let _4096: String?
let hls: String?
let max: String?
}

Properties

| | Property | Description | | | | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | _848 | 848px wide video with a 1.3MBps video rate, 96KBps audio rate. Only included if the Media is a video. | | | | _1440 | 1440px wide video with a 4.4MBps video rate, 128KBps audio rate. Only included if the Media is a video. | | | | _2160 | 2160px wide video with a 10MBps video rate, 192KBps audio rate. Only included if the Media is a video. | | | | _4096 | 4096px wide image. This image should be used on mobile devices, as larger images may cause some devices to crash. Only included if the Media is a video. | | | | clip | A 6-second, 1440px wide clip, with a 2MBps video rate, no audio. | | | | hls | URL for an HLS master playlist containing streams in all of the above resolutions which are no wider than the original Media. Only included if the Media is a video. | | | | max | The Media in its largest available size (the original size). | |

SvrfMediaVideos

Resized mp4 (H.264) videos of the Media. Only included if the Media is video. Resolutions larger than the original size will not be included (the original is included as max). For stereoscopic content, this will be a monoscopic version of the top or left channel.

Declaration

class SvrfMediaStereo {
let _848: String?
let _1440: String?
let _2160: String?
let _4096: String?
let clip: String?
let hls: String?
let max: String?
}

Properties

PropertyDescription
_848848px wide video with a 1.3MBps video rate, 96KBps audio rate. Only included if the Media is a video.
_14401440px wide video with a 4.4MBps video rate, 128KBps audio rate. Only included if the Media is a video.
_21602160px wide video with a 10MBps video rate, 192KBps audio rate. Only included if the Media is a video.
_40964096px wide image. This image should be used on mobile devices, as larger images may cause some devices to crash. Only included if the Media is a video.
clipA 6-second, 1440px wide clip, with a 2MBps video rate, no audio.
hlsURL for an HLS master playlist containing streams in all of the above resolutions which are no wider than the original Media. Only included if the Media is a video.
maxThe Media in its largest available size (the original size).

SvrfMediaType

The type of the SvrfMedia. This should influence the media controls displayed to the user.

Declaration

enum SvrfMediaType: String {
case photo = "photo"
case video = "video"
case _3d = "3d"
}

Properties

PropertyDescription
photoA photo file (png or jpeg).
videoA video file (mp4 and HLS).
_3dA 3D model (fbx, gltf, glb, and/or glb-draco).