Skip to content

ShelbyTV/shelby-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Shelby Universal Player

--there can be only one--

Hello there! The Shelby Player is a javascript video player that plays any video that Shelby.tv supports which currently is: youtube, vimeo, college humor, blip.tv, hulu and techcrunch. We provide one consistent set of api calls to control any of these players.

Usage

You need to include jquery and the uniplayer in your client-side code.

	<!-- Include jQuery -->
	<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>
	<!-- Include the Shelby Player -->
	<script type='text/javascript' src='shelby-player.js'></script>

Create a DOM element in which to house your uniplayer.

	<!-- Here's where your shelby player will be -->
	<div id="player-div" style="position:relavitve;float:left;width:1000px;height:500px"></div>

Now instantiate a uniplayer, passing an options object (specifying the id of your DOM container), and an onStateChange callback. The onStateChange callback gets called every time something changes in the player.

	var options = {
	      container:'player-div',
	      sidebar:false
	};
	
	var myStateChangeFunc = function(data, player){      
		if (data.state.playerLoaded){
			
		}
		if (data.state.buffering){
			
		}
		if (data.state.playing){
			
		}
		if (data.state.videoEnded){
		}
		if (data.state.muted){
			
		}
	};

	var player = new ShelbyPlayer(options, myStateChangeFunc);

Play broadcasts by passing in the channel id and broadcast id

	player.playBroadcast(channelId, broadcastId);

You can also programmatically control playback

	player.togglePlay(); // play/pause video
	player.toggleMute(); // mute/unmute video

About

Shelby Universal Player API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published