CREATE YOUR WORLD
Recording
VideoRecording
5min
you can save or share videos within the world using video related functions in the worldvideorecorder api, and create feeds using videos in order to use the video recording and save/share/feed post functions, you must create an import statement as follows import { worldvideorecorder } from 'zepeto world'; worldvideorecorder api provides the following video related functions api description worldvideorecorder startrecording(camera unityengine camera, resolutions videoresolutions, durationsecond number)\ boolean start recording the video you can set the recording camera, video resolution, and recording time as parameters the return result indicates whether or not the recording start was successful \ enum videoresolutions { w1280xh720 = 0, w720xh1280 = 1, w1920xh1080 = 2, w1080xh1920 = 3 } \ durationsecond the maximum value is 60, so please enter it as less than 60 if possible worldvideorecorder stoprecording() stop recording the video in progress worldvideorecorder isrecording()\ boolean returns on whether to proceed with recording the video worldvideorecorder savetocameraroll(callback system action$1) save the video to the photo library worldvideorecorder share(callback system action$1) share the video with an external app worldvideorecorder createfeed(contents string, $callback system action$1) upload the video to the feed the first factor, contents, allows you to designate the content of a post worldvideorecorder addvideoplayercomponent(playerobject unityengine gameobject, rendertexture unityengine rendertexture)\ unityengine video videoplayer add video player components to the gameobject where you want to play the video, and connect the recorded video files this returns the added video player and lets you designate the width, height, or rendertexture to play the video, depending on the parameters worldvideorecorder getthumbnail()\ unityengine texture2d; returns the thumbnail of the recorded video next is an example of calling up functions of the save/share/feed post my videos features within the world video recorder it is unavailable to check it in the unity editor environment, but available to check it when playing through the app the resolution is recorded at the specified value when it is saved as a file, but the resolution may change when it's uploaded to zepeto feed if you enter a value greater than 60 for durationsecond, recording will not work properly worldvideorecorder savetocameraroll(result => {console log(`${result}`)}); worldvideorecorder share(result => {console log(`${result}`)}); worldvideorecorder createfeed("\[contents]", result => {console log(`${result}`)}); the following is an entire example code that uses functions of my video recording functions within the worldvideorecorder using rendertexture import { camera, gameobject, rendertexture } from 'unityengine'; import { button, rawimage } from 'unityengine ui'; import { zepetoscriptbehaviour } from 'zepeto script'; import { videoresolutions, worldvideorecorder } from 'zepeto world'; export default class worldvideorecorderexample extends zepetoscriptbehaviour { // worldvideorecorder video ui public startrecordingbutton button; public stoprecordingbutton button; public savevideobutton button; public sharevideobutton button; public createfeedbutton button; public getthumbnailbutton button; public thumbnailimage rawimage; // recorder camera public recordercamera camera; // target texture public targettexture rendertexture; // videoplayer object private videoplayerobject gameobject; awake() { this videoplayerobject = new gameobject(); } start() { this startrecordingbutton onclick addlistener(() => { if (false == worldvideorecorder startrecording(this recordercamera, videoresolutions w1280xh720, 15)) { return; } this startcoroutine(this checkrecording()); }); this stoprecordingbutton onclick addlistener(() => { if (false == worldvideorecorder isrecording()) { return; } worldvideorecorder stoprecording(); }); this savevideobutton onclick addlistener(() => { if (false == worldvideorecorder isrecording()) { worldvideorecorder savetocameraroll(result => { console log(`${result}`) }); } }); this sharevideobutton onclick addlistener(() => { if (false == worldvideorecorder isrecording()) { worldvideorecorder share(result => { console log(`${result}`) }); } }); this createfeedbutton onclick addlistener(() => { if (false == worldvideorecorder isrecording()) { worldvideorecorder createfeed("\[contents]", result => { console log(`${result}`) }); } }); this getthumbnailbutton onclick addlistener(() => { if (false == worldvideorecorder isrecording()) { this thumbnailimage texture = worldvideorecorder getthumbnail(); } }); } checkrecording() { while (worldvideorecorder isrecording()) { yield null; } let videoplayer = worldvideorecorder addvideoplayercomponent(this videoplayerobject, this targettexture); if (videoplayer == null) { return; } videoplayer play(); } } after writing the script, create the necessary buttons and raw images on the canvas after that, assign each component in the inspector for the camera, you can use a normal camera component for target textures, create > please create it as a render texture 👍 tip if you use the same render texture as the screenshot, it may not render correctly, so please create a new render texture just for recording and use it you can test the video recording function by running it through the qr mobile build