memories/src/native/video.ts

20 lines
521 B
TypeScript
Raw Normal View History

import { nativex } from './api';
import { addOrigin } from './basic';
import type { IPhoto } from '@typings';
/**
* Play a video from the given URL.
* @param photo Photo to play
* @param urls URLs to play (remote)
*/
export async function playVideo(photo: IPhoto, urls: string[]) {
nativex?.playVideo?.(photo.auid ?? String(), photo.fileid, JSON.stringify(urls.map(addOrigin)));
}
/**
* Destroy the video player.
*/
export async function destroyVideo(photo: IPhoto) {
nativex?.destroyVideo?.(photo.fileid);
}