- Start a Share Session
- Controlling an Active Share Session
- Implementing Callback Functions
- Access Share Session Properties
- Installing the Browser Extension
Start a Share Session
After you have created a share session (see Make a Share Session Request), these functions can be used to start the share session.
screenleap.startSharing(presenterAppType, screenShareData, callbacks)
Starts a share session using the specified presenter app.
presenterAppType options are:
- IFREE - Installation-free sharing. Neither the presenters nor viewers need to install any software.
- 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.
screenShareData is the JSON object received from a successful request to make
a new share session.
that you implement that will be called when specific share session events occur during the course of a share session.
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 share session.
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.
screenShareStartError- This callback will be called when the share session cannot be started. Use this callback to let the user know that the share session 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 Share Session
screenleap.stopSharing()- Stop the active share session.
screenleap.pauseSharing(successCallback, errorCallback)- Pause the active share session.
screenleap.resumeSharing(successCallback, errorCallback)- Resume a paused but active share session.
- 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 share session 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 share session, 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 share session.
- These functions will get called when the share session gets paused or resumed, respectively.
- This function will get called when audio conferencing is enabled to display the button used to toggle muting/un-muting of the user's microphone.
- This function will get called when audio conferencing is disabled to hide the button used to toggle muting/un-muting of the user's microphone.
- This function is called when we are unable to start recording the share session due to an error. When calling
errorCallbackis passed in, errors starting the recording will be passed to the callback. Otherwise, errors starting the recording will be reported via
screenleap.onRecordStartError. Even if you pass
screenleap.startRecording, you should still implement
screenleap.onRecordStartErrorso you get notified when recording couldn't be started when
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 Share Session Properties
screenleap.getScreenShareCode()- returns the 9-digit share code for this share session.
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.