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
Property | Description |
---|---|
id | The unique ID of this Media. |
title | The title of the Media, suitable for displaying. |
description | A description of the Media. |
authors | The Media's authors. This should be displayed when possible. |
site | The site that this Media came from. This should be displayed when possible. |
canonical | The canonical page this Media can be found at via Svrf. |
url | The original page this Media is located at. |
embedUrl | A player that can be embedded using an <iframe> tag to play the Media. |
embedHtml | An <iframe> tag that embeds a player that plays the Media. |
type | See SvrfMediaType. The type of the Media. This should influence the media controls displayed to the user. |
adult | Whether the Media is adult content. |
width | The width, in pixels, of the Media's source. |
height | The height, in pixels, of the Media's source. |
duration | The duration of the Media in seconds. |
metadata | See SvrfMediaMetadata. |
files | See SvrfMediaFiles. |
SvrfMediaMetadata
Metadata about the Media
.
Declaration
class SvrfMediaMetadata {let isFaceFilter: Bool?let hasBlendShapes: Bool?let requiresBlendShapes: Bool?}
Properties
Property | Description |
---|---|
isFaceFilter | For 3D Media, denotes that this model can be applied as a face filter overlay on a video of a face. |
hasBlendShapes | For 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. |
requiresBlendShapes | For 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
Property | Description |
---|---|
gltf | A 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. |
glb | This 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-draco | This 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. |
images | See SvrfMediaImages. |
stereo | See SvrfMediaStereo. |
videos | See 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
Property | Description |
---|---|
_136 | 136px wide image. This image may be used for thumbnailing. |
_540 | 540px wide image. This image may be used for thumbnailing. |
_720 | 720px wide image. This image may be used for thumbnailing. |
_1080 | 1080px wide image. This image should be used for previews or other uses requiring clear resolution at low bandwidth. |
_4096 | 4096px wide image. This image should be used on mobile devices, as larger images may cause some devices to crash. |
_8192 | The image at a reasonably large resolution that can be used for a better desktop experience. |
_1080Watermarked | 1080px wide watermarked image. This image should be used for sharing on social media. |
_720x405 | A 16:9 image. This image may be used for thumbnailing. |
_720x540 | A 4:3 image. This image may be used for thumbnailing. |
_720x720 | A 1:1 image. This image may be used for thumbnailing. |
max | The 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
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). |
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
Property | Description |
---|---|
photo | A photo file (png or jpeg ). |
video | A video file (mp4 and HLS ). |
_3d | A 3D model (fbx , gltf , glb , and/or glb-draco ). |