In this sample, you may use the setCameraMode function to initialize the
perspective of the camera of the web player by adjusting the lens modes. There are three modes for the
camera lens, each may cause different depth appearances for the character from
weak to strong as the character is performing.
Using the setCameraMode Function
This sample contains 5 buttons, their behaviors are:
Click the three left buttons to change the lens mode of the camera, and
click the right two buttons to move the character to better observe
the different effects of the lens.
Click the first button, Telephoto, to set the camera's
perspective to flat mode. The character's depth will appear the weakest.
Click the second button, Standard, to set the camera's
perspective to standard mode. The character's depth will appear average.
Click the third button, Wide Angle, to set the camera's
perspective to fish-eye mode. The character's depth will appear stronger.
Click the fourth button, Move Character, to move the character from
left to right to observe the camera perspective result.
Click the fifth button, Back to Center, to move the character back
to the center of the web player.
Copy and paste the code in-between the <head> and
tags of your custom web page.
The purposes of the functions:
This function defines the address and the position of the CrazyTalk Web Player
in the custom web page and initializes the player with the camera perspective
set to Telephoto mode;
meanwhile, preloading a project (Cute_Dog.uctProject) and an idle
file without playing back.
function moves the current character from left to
right sides of the web player.
function moves the current character back to the
center of the web player.
function set the camera to Telephoto
function set the camera to Standard mode.
function set the camera to Wide Angle mode.
The adjustable codes in the functions: $(function ()
Replace the below address of the CrazyTalk Web Player with the one within your self-hosting
player.setCameraMode("..."): This line
determine the initial camera mode. The possible
telephoto: This value make the camera
perspective flat, which looks like a telephoto
standard: This value increases the
dimension of the camera's perspective.
wideAngle: This value sets the
camera's perspective to strongest, which
causes a fish-eye effect.