-
Notifications
You must be signed in to change notification settings - Fork 0
API Cheat Sheet [media5]
Working with camera and microphone. Playing the streaming as well.
Starts the camera if it has supported by user device.
Parameters
-
video:DOM
- The DOM element of video tag. Required -
width:number
- The width of video object. Required -
height:number
- The height of video object. Required -
callback:function
- The callback called after enum devices. Optional
Return
Returns the Camera
instance object.
Example
import {element5 as $, media5} from '@bapquad/element5'
let video = $.Create("video#camera");
let camera = media5.StartCamera(video, 320, 240, (devices) => {
console.log(devices.length);
});
// Print the camera object
console.log(camera);
Starts the microphone if it has supported by user device.
Parameter
-
callback:function
- The callback function called when init completely a session.
Return
Returns the PhoneACTX
instance object.
Example
import {element5 as $, media5} from '@bapquad/element5'
let mic = media5.StartMicrophone();
// Print the microphone object
console.log(mic);
Starts playing the live stream such that IP cameras.
Parameters
-
element:DOM
- The element renders live stream. Required -
url:string
- The url of the live stream. Required -
width:number
- The width of the live stream. Required -
height:number
- The height of the live stream. Required
Return
Returns the assigned image element.
Example
import {element5 as $, media5} from '@bapquad/element5'
let image = $.create("img");
// Let view the IP Camera.
media5.StartStream(image, "http://154.453.125.14/mjpeg", 640, 480);
Manipulating the microphone audio context.
Retrieves the number of microphone devices.
Parameter
- Has no parameter.
Return
Return the number of microphone devices.
Example
import {element5 as $, media5} from '@bapquad/element5'
microphone = media5.StartMicrophone((devices)=>{
console.log(microphone.numberDevice());
});
stop.on("click", ()=>{
microphone.stopSession();
});
next.on("click", ()=>{
microphone.nextDevice();
});
Stop the session of current microphone.
Parameter
- Has no parameter.
Return
Returns the self PhoneACTX
instance object.
Example
import {element5 as $, media5} from '@bapquad/element5'
microphone = media5.StartMicrophone((devices)=>{
console.log(microphone.numberDevice());
});
stop.on("click", ()=>{
microphone.stopSession();
});
next.on("click", ()=>{
microphone.nextDevice();
});
Stop current session and initialize the next device in the list of microphone devices.
Parameter
-
callback:function
- The function is called when created a session completely.
Return
Returns the self PhoneACTX
instance object.
Example
import {element5 as $, media5} from '@bapquad/element5'
microphone = media5.StartMicrophone((devices)=>{
console.log(microphone.numberDevice());
});
stop.on("click", ()=>{
microphone.stopSession();
});
next.on("click", ()=>{
microphone.nextDevice();
});
Manipulating the camera object.
Switch the next camera in the list of camera devices.
Parameter
- Has no parameter.
Return
Returns the self Camera
instance.
Example
import {element5 as $, media5} from '@bapquad/element5'
let video = $.Create("video#camera");
let camera = media5.StartCamera(video, 320, 240, (devices) => {
console.log(devices.length);
});
$('button#next').on("click", () => {
camera.nextCamera();
});
Bapquad Games since 2015
- Get Started
- Working with DOM
- Constructing the StyleSheet
- Working with Sprite
- Working with Timeline
- Working with Scroller
- Working with Camera
- Working with Microphone
- Making the Ajax Request
- Opening a Websocket
- Working with Storage
- Checking User Agent
- Working with GPS
- Working with Router
- Playing the Stream