Media Platform JS SDK

PLEASE NOTE: this docs are for the current version 6 and later. You can find docs for versions 5- here: https://github.com/wix/media-platform-js-sdk/wiki .

Welcome to the Wix Media Platform - JavaScript SDK wiki! Here you can find the full documentation of the SDK's public methods.

First, if you haven't done so yet, register at Wix Media Platform, and create your organization, project and application.

Installation

npm i --save media-platform-js-sdk

Now you can instantiate the Media Platform in your project:

Instantiating the Media Platform in the Server

import {MediaPlatform} from 'media-platform-js-sdk/server';

const mediaPlatform = new MediaPlatform({
    domain: '<As appears in the application page>',
    appId: '<As appears in the application page>',
    sharedSecret: '<As appears in the application page>'
});

Instantiating the Media Platform in the Browser

import {MediaPlatform} from 'media-platform-js-sdk/browser';

const mediaPlatform = new MediaPlatform({
    domain: '<As appears in the application page>',
    authenticationUrl: '<your authentication url - see example below>'
});

From CDN:

<script src="https://static.parastorage.com/unpkg/media-platform-js-sdk@6.0.0/dist/statics/media-platform.bundle.min.js"></script>
const mediaPlatform = new MP.MediaPlatform({
    domain: '<As appears in the application page>',
    authenticationUrl: '<your authentication url - see example below>'
});

Authentication URL Node.js (with express) example:

/**
 * Your own authentication mechanism comes here
 */
app.get('/media-platform/auth-header', function (req, res, next) {
    /**
     * @description by default, the header authenticates the application
     * @type {{Authorization}}
     */
    const header = mediaPlatform.getAuthorizationHeader();

    res.send(header);
});