Class: MediaPermission

Overview

Examples:

Draw Visitor's attention to media permission prompt

function showArrowsPointingToPermissionPrompt(response) {
  // Your code
}

function hideArrowsPointingToPermissionPrompt(response) {
  // Your code
}

var engagementRequest = salemove.requestEngagement('text');

engagementRequest.engagementPromise.then(function(engagement) {
  var handleMediaPermissionRequest = function(request) {
    showArrowsPointingToPermissionPrompt();
    request.responsePromise.then(function(response) {
      hideArrowsPointingToPermissionPrompt();

      if (response === 'allowed') {
        // Handle Visitor allowed access to media device
      }

      if (response === 'denied') {
        // Handle Visitor denied access to media device
      }
    }).catch(function(error) {
      // Handle error
    });
  };

  engagement.addEventListener(
    engagement.EVENTS.MEDIA_PERMISSION_REQUEST,
    handleMediaPermissionRequest
  );
});

Property Summary

(Promise) responsePromise

Fulfilled with a String response or rejected with an Error if the process fails for any reason. In case of a fulfilled promise, the response can be one of 'allowed' or 'denied' depending on whether the Visitor allowed or denied access to the requested media device. The Error may have one of the following causes: INTERNAL_ERROR.

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: