UNPKG

@alifd/meet-react

Version:

Fusion Mobile React UI System Component

41 lines 1.13 kB
import { isStrictMiniApp, isStrictWechatMiniProgram } from '../utils'; export function getWXVideoContext(id) { if (typeof wx !== 'undefined') { var _internal; if (document && document.getElementById && document.getElementById(id)) { _internal = document.getElementById(id)._internal; } return wx.createVideoContext(id, _internal); } return null; } export function getMiniappVideoContext(id) { if (typeof my !== 'undefined') { return my.createVideoContext(id); } return null; } export function getContexts(refs, sliderPrefixId) { return refs.map(function (ref, index) { var id = "".concat(sliderPrefixId, "-").concat(index); var node = ref; if (isStrictMiniApp) { node = getMiniappVideoContext(id); } else if (isStrictWechatMiniProgram) { node = getWXVideoContext(id); } return node; }); } export function pauseAll(contexts) { contexts.forEach(function (ctx) { if (ctx.pause) { ctx.pause(); } }); } export function play(contexts, index) { if (contexts && contexts[index] && contexts[index].play) { contexts[index].play(); } }