- Start a Screen Share
- Controlling an Active Screen Share
- Implementing Callback Functions
- Access Screen Share Properties
- Installing the Browser Extension
Start a Screen Share
After you have created a screen share session (see Make a Screen Share Request), these functions can be used to start the screen share.
screenleap.startSharing(presenterAppType, screenShareData, callbacks)
Starts a screen share using the specified presenter app.
presenterAppType options are:
- NATIVE - The native Screenleap application for Mac and Windows. The native application has the advantage of only requiring a download the first time it is run, or when an update is required.
- IN_BROWSER - The Screenleap browser extensions allows your users to share their screens by only installing a browser extension. Only available for Chrome. The recommended option for presenters on Linux.
- DEFAULT Deprecated - If the user is on a Mac or Windows machine, this option will launch the appropriate native app.
screenShareData is the JSON object received from a successful request to make
a new screen share.
that you implement that will be called when specific screen share events occur during the course of a screen share.
The available callbacks are:
NATIVEshares, this callback will be called when the download of the native app begins. Use this callback to show instructions to the users for installing the app and starting the screen share.
NATIVEshares, this callback will be called if the attempt to start the screen share using the local web server fails. If you have configured your integration to start the native app using the custom protocol handler, we will actually first make an attempt to start the screen share using the local web server. If it fails, then we attempt to start the screen share using the custom protocol handler. We do this because it gives the user a better screen share experience to start the screen share using the local web server if it's supported because it does not require asking the user for permission to use the custom protocol handler. The
localWebServerStartFailedcallback is a good place to implement the code to show your users the directions for granting permission to use the custom protocol handler.
screenShareStarting- For all shares, this callback will be called when the downloaded app starts. Use it to display feedback to the user that the share is starting.
appConnectionFailed- This callback will be called when the page containing the screenleap.js file is not able to connect with the app server. Use this callback to ask the user to check his/her Internet connection.
screenShareStartError- This callback will be called when the screen share cannot be started. Use this callback to let the user know that the screen share was unable to be started and allow them to try starting a new share.
Downloads the native app and calls the
onAppDownloadEnd function when the download is complete.
nativeDownloadStarting: function to call before the download begins. Use this call to display the installation instructions.
Attempts to start the native app using the custom protocol handler. This call is usually made from a link in the instructions shown the users when the automatic attempt to start the presenter app using the custom protocol handler fails.
Controlling an Active Screen Share
screenleap.stopSharing()- Stop the active screen share.
screenleap.pauseSharing(successCallback, errorCallback)- Pause the active screen share.
screenleap.resumeSharing(successCallback, errorCallback)- Resume a paused but active screen share.
- This function is called when the web page is able to successfully connect to the presenter app. If you do not define this function, the default behavior is to pop up an alert.
- This function is called when the presenter app has successfully connected to the app server.
screenleap.onPresenterConnectusually gets called after
screenleap.stopRecording) only works after the presenter app has connected to the app server, so you'll want to use the
screenleap.onPresenterConnectcallback for these situations.
- This function is called when a screen share ends. If you do not define this function, the default behavior is to pop up an alert.
- These functions are called whenever a viewer joins or leaves a screen share, respectively. The
participantIdis a Screenleap identifier for a participant. The
externalIdparameter will only be included if you provided an optional
externalIdfor this viewer's connection.
Note that this information is provided in order to give the presenter real-time information about viewer presence. It is not intended to be used for billing purposes. If a viewer's Internet connection drops and reconnects repeatedly, each event will trigger a callback. Please make use of the
callbackOnEndUrlcallback to receive billing information for a completed screen share.
- These functions wil get called when the screen share gets paused or resumed, respectively.
screenleap.error(action, message, err)
- This function is called when an error is encountered. The
actionis the name of the action that triggered the error. The
messagemay provide some additional explanation of the issue. The
erris either an
Errorobject or an
XmlHttpRequestobject, depending on the type of error. The default behavior is to pop up an alert to help with integration. You will want to override this before releasing to your users so that your users are not shown an alert everytime there is an error.
Important Note: These functions are defined on the screenleap object which is instantiated by
As a result, it is important that you implement these callbacks in
window.onload to ensure that the screenleap
object is instantiated first.
Sample Callback Implementation
Access Screen Share Properties
screenleap.getScreenShareCode()- returns the 9-digit share code for this screen share.
screenleap.getViewerUrl()- returns the URL for viewing this share.
Installing the Browser Extension
trueif the user's browser is supported for Screenleap browser extensions.
screenleap.checkIsExtensionInstalled(yesCallback, noCallback)- Checks whether the Screenleap browser extension is installed, then calls the appropriate callback function.
screenleap.checkIsExtensionEnabled(yesCallback, noCallback)- For Chrome only, checks whether the extension is enabled, then calls the appropriate callback function.
screenleap.installExtension(successCallback, errorCallback, redirectUrl)- Installs the Screenleap extension, if it is not already installed, then calls the appropriate callback function. The Chrome installation will require a temporary redirect to a
screenleap.compage. By default, the page is automatically redirected back to the originating URL on completion of the installation. To override this behavior, you may provide an alternate
redirectUrlto which the user will be redirected after the installation completes.