GithubHelp home page GithubHelp logo

isabella232 / javascript-mapi-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brightcoveos/javascript-mapi-wrapper

0.0 0.0 0.0 17 KB

This project provides a starting point for integrating the Brightcove Media API into your application. It provides simple ways to interact with the API.

Home Page: http://opensource.brightcove.com/project/JavaScript-MAPI-Wrapper/

JavaScript 100.00%

javascript-mapi-wrapper's Introduction

About

WARNING: The Media API is deprecated and should not be used for new projects. More information.

This project provides a starting point for integrating the Brightcove Media API into your application. It provides simple ways to interact with the API.

Compatibility Notice

Please note that the JavaScript MAPI Wrapper v1.0+ is not compatible with any previous versions (when it was known as "Kudos"). The class name has been changed, numerous functions have been re-named, and methods have been updated to take advantage of Brightcove API changes.

If you need assistance in determining what changes have been made, please send an e-mail to [email protected] with your request.

Basic Usage

A basic example containing a query for all videos in an account.

<script src="bc-mapi.js" type="text/javascript"></script>
<script type="text/javascript">
	// Make a call to the API requesting content
	// Note that a callback function is needed to handle the returned data
	BCMAPI.find("find_all_videos", { "callback" : "handle" });
	
	// Our callback loops through the returned videos, alerting their names
	function handle (pResponse) {
		for (var pVideo in pResponse.items) {
			alert(pVideo.name);
		}
	}
</script>

Advanced Usage

An advanced example containing a query for all videos in an account as well as instantiation options.

<script src="bc-mapi.js" type="text/javascript"></script>
<script type="text/javascript">
	// Set the default token and handler for calls
	BCMAPI.token = "TOKEN.GOES.HERE";
	BCMAPI.callback = "MyClass.myMethod";
	
	// Our call response will now be sent to MyClass.method
	BCMAPI.find("find_all_videos");
	
	// With a token and callback function set, we can use find()'s params as a selector
	BCMAPI.find("find_video_by_id", 1234567890);
	
	// You can also omit "find" from all API commands for efficiency
	BCMAPI.find("video_by_id", 1234567890);
</script>

Search Videos Usage

An example containing a search_videos call with multiple search terms.

<script src="bc-mapi.js" type="text/javascript"></script>
<script type="text/javascript">
	// Set the default token and handler for calls
	BCMAPI.token = "TOKEN.GOES.HERE";
	BCMAPI.callback = "MyClass.myMethod";
	// Set params
	var params = {};
	params.any = ["tag:sea","tag:fish"];
	
	// Our call response will now be sent to MyClass.method
	BCMAPI.search(params);
</script>

Methods

BCMAPI

The Media API wrapper class.

Properties

  • token Public - The Brightcove API token

    Type: String

  • callback Public - The function to execute upon API return

    Type: Function

  • request *Public - The full request that is executed (for debugging purposes)

    Type: String

find

Performs an API query.

Arguments

  • pCommand A Brightcove API method

    Default: Type: String

  • pParams Either an object containing the API parameters to apply to the given command, or a single value which is applied to the command's default selector

    Default: Type: Mixed

Return Value

true

search

Performs an API search query.

  • pParams Either an object containing the API parameters to apply to the given command, or a single value which is applied to the command's default selector; for "any", "all" or "none" arguments, use a string value for a single search term, or an array value for multiple search terms

    Default: Type: Mixed

Return Value

true

javascript-mapi-wrapper's People

Contributors

brianfranklin avatar mcongrove avatar mister-ben avatar rcrooks avatar rmenon- avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.