Genymotion Virtual Device Web Player
This repository contains the Genymotion device web renderer JavaScript SDK. It provides an easy way to integrate Genymotion devices running in the cloud into any web application. You will be able to display an emulator screen and interact with the device.
It focuses on:
For more information about Genymotion devices, please visit genymotion website.
A Modern, WebRTC compatible, Web browser:
Using yarn:
yarn add @genymotion/device-web-player
Using npm:
npm install @genymotion/device-web-player
Package import (commonJS):
const {DeviceRendererFactory} = require('genymotion/device-web-player');
<style lang="scss">
@import "genymotion-device-web-renderer/dist/css/device-renderer.min.css";
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@genymotion/[email protected]/dist/css/device-renderer.min.css">
<script src="https://cdn.jsdelivr.net/npm/@genymotion/[email protected]/dist/js/device-renderer.min.js"></script>
Use DeviceRendererFactory
to instanciate one or more device renderer.
All you need is an HTML element to use as a container. See example below.
To find your instance WebRTC address, use the SaaS API
or check the PaaS documentation, based on your device provider.
<!-- OPTIONAL: Import google maps library with your API key to enable map positioning feature
<script src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxxxxxx-yyyyyyyyyyyyyy"></script>
-->
<div id="genymotion"></div>
<script>
// Instance address
const webrtcAddress = 'wss://x.x.x.x';
const container = document.getElementById('genymotion');
// See "Features & options" section for more details about options
const options = {
template: "renderer", // template defines how renderer is displayed
token: 'i-XXXXXXXXXX', // token is the shared secret to connect to your VM
fileUpload: false // requires fileUploadUrl
};
// Device renderer instanciation
const { DeviceRendererFactory } = window.index
const deviceRendererFactory = new DeviceRendererFactory();
const renderer = deviceRendererFactory.setupRenderer(container, // the container element or element ID to use
webrtcAddress, // the websocket address of your instance connector
options // options object to enable or disable features
);
// Disconnect the device renderer, closing any open data channels.
window.addEventListener('beforeunload', function() {
renderer.disconnect();
});
</script>
A device renderer instance can be configured using the options
argument (object). Possible configuration key / value are described below.
template
String
renderer
PaaS
, SaaS
bootstrap
, fullscreen
, fullwindow
, renderer
, renderer_minimal
, renderer_no_toolbar
, renderer_partial
.token
String
undefined
PaaS
, SaaS
i18n
Object
{}
PaaS
, SaaS
stun
Object
{}
PaaS
, SaaS
{
urls: [
'stun:stun-server1.org:80',
'stun:stun-server2.org:443',
...
],
}
turn
Object
{}
PaaS
, SaaS
{
urls: [],
username: "myUsername",
credential: "myPassword",
default: false // Whether or not we should use the TURN servers by default. Default: false.
}
streamResolution
Boolean
true
SaaS
streamBitrate
Boolean
false
SaaS
touch
Boolean
true
PaaS
, SaaS
mouse
and keyboard
.mouse
Boolean
true
PaaS
, SaaS
touch
and keyboard
.keyboard
Boolean
true
PaaS
, SaaS
volume
Boolean
true
PaaS
, SaaS
rotation
Boolean
true
PaaS
, SaaS
navbar
Boolean
true
PaaS
, SaaS
power
Boolean
true
PaaS
, SaaS
fullscreen
Boolean
true
PaaS
, SaaS
camera
Boolean
true
PaaS
, SaaS
microphone
property is also true, then the default audio input will be used as well.microphone
Boolean
false
PaaS
fileUpload
Boolean
true
PaaS
, SaaS
fileUploadUrl
String
undefined
PaaS
, SaaS
fileUpload
is set to true
.clipboard
Boolean
true
PaaS
, SaaS
battery
Boolean
true
PaaS
, SaaS
gps
Boolean
true
PaaS
, SaaS
<!-- OPTIONAL: Import google maps library with your API key to enable map positioning feature -->
<script src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxxxxxx-yyyyyyyyyyyyyy"></script>
gpsSpeedSupport
Boolean
false
PaaS
, SaaS
capture
Boolean
true
PaaS
, SaaS
identifiers
Boolean
true
PaaS
, SaaS
Enables or disables the identifiers widget. This widget can be used to set the identifiers (Android ID / IMEI) of the Android virtual device.
network
Boolean
true
PaaS
, SaaS
phone
Boolean
true
PaaS
, SaaS
Enables or disables the phone widget. This widget can be used to send SMS or phone call the Android virtual device.
Baseband
Boolean
false
PaaS
diskIO
Boolean
true
PaaS
, SaaS
gamepad
Boolean
false
SaaS
, PaaS
biometrics
Boolean
true
SaaS
, PaaS
translateHomeKey
Boolean
false
PaaS
META
+ ENTER
connectionFailedURL
String
undefined
SaaS
, PaaS
giveFeedbackLink
String
giveFeedbackLink
SaaS
, PaaS
Read through our contributing guidelines to learn about our submission process, coding rules and more.