Microtrust Compatibility Match
Browser has strict limits on video playback (playback behavior must be triggered by user),@realsee/vreo
has circumvented the browser limit on video playback automatically.
But it is a credit to auto-play limit for audio videos in micromessaging browsers needs to call microJS-SDK to trigger WeixinJSBridgeReadady
events before they can be implemented.
While @realsee/vreo
does not depend on micromessaging JS-SDK , you can createHTMLVideoElement
instances in advance and then specify via configuration when initializingvreoplayer
instances HTMLVideoElement
instances with reference:
// Create an instance of HTMLVideoElement
const creatVideo = (): HTMLVideoElement => {
const video = document.createElement("video");
video.setAttribute("playsinline", "true");
video.setAttribute("webkit-playsinline", "true");
video.setAttribute("autoplay", "true");
return video;
};
const creatAudio = (): HTMLVideoElement => {
const audio = document.createElement("audio");
audio.setAttribute("autoplay", "true");
return audio;
};
// Create Video in advance
// Video special effects
const videoEffect = creatVideo();
// Video advertisement
const modelTVVideo = creatVideo();
// Video number Human image
const videoInstance = creatVideo();
// No digital person, only audio
const audioInstance = createAudio();
// Wechat limit:needs to be triggered once in WeixinJSBridgeReady callback
document.addEventListener(
"WeixinJSBridgeReady",
() => {
videoEffect.play();
modelTVVideo.play();
videoInstance.play();
audioInstance.play;
},
false
);
// create Player instance
const vreoplayer = new Player(five, {
videos: {
videoEffect, // HTMLVideoElement for video effects
modelTVVideo, // The HTMLVideoElement that video ads depend on
},
videoAgentMeshOptions: {
videoInstance,
audioInstance,
},
});
In this way, auto-broadcast effects can also be used in the micromessaging browser or micromessaging applet WebView
.