2023-10-02 02:04:01 +00:00
|
|
|
import { nativex } from './api';
|
|
|
|
import { addOrigin } from './basic';
|
2023-10-30 00:30:11 +00:00
|
|
|
import type { IPhoto } from '@typings';
|
2023-10-02 02:04:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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[]) {
|
2023-10-04 22:09:43 +00:00
|
|
|
nativex?.playVideo?.(photo.auid ?? String(), photo.fileid, JSON.stringify(urls.map(addOrigin)));
|
2023-10-02 02:04:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy the video player.
|
|
|
|
*/
|
|
|
|
export async function destroyVideo(photo: IPhoto) {
|
2023-10-04 19:45:35 +00:00
|
|
|
nativex?.destroyVideo?.(photo.fileid);
|
2023-10-02 02:04:01 +00:00
|
|
|
}
|