Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the ability to set the user vote from javascript, as well as sy…

…nchronize the user vote values between multiple players.
  • Loading branch information...
commit 841346c10f0a3d2ab3c7767ecc13cfc5fc7df1e4 1 parent bdd14c5
Travis Tidwell authored
View
2  com/tmtdigital/dash/display/Playlist.as
@@ -1 +1 @@
-/**
+/**
View
2  com/tmtdigital/dash/display/voter/DashVoter.as
@@ -1 +1 @@
-/**
+/**
View
94 com/tmtdigital/dash/display/voter/TagVoter.as
@@ -1,93 +1 @@
-package com.tmtdigital.dash.display.voter
-{
- import com.tmtdigital.dash.display.voter.Voter;
- import com.tmtdigital.dash.display.Skinable;
- import com.tmtdigital.dash.events.DashEvent;
-
- // Import all dependencies
- import flash.display.MovieClip;
-
- // Declare our TagVoter class.
- public class TagVoter extends Skinable
- {
- public function TagVoter( _skin:MovieClip )
- {
- super( _skin );
- }
-
- // The Voter constructor.
- public override function setSkin( _skin:MovieClip )
- {
- super.setSkin( _skin );
-
- // Set up our voters.
- vote = new Voter( _skin.vote );
- vote.addEventListener( DashEvent.VOTE_GET, voteHandler );
- vote.addEventListener( DashEvent.VOTE_SET, voteHandler );
- vote.addEventListener( DashEvent.VOTE_DELETE, voteHandler );
- vote.addEventListener( DashEvent.PROCESSING, voteHandler );
-
- uservote = new Voter( _skin.uservote, true );
- uservote.addEventListener( DashEvent.VOTE_GET, voteHandler );
- uservote.addEventListener( DashEvent.VOTE_SET, voteHandler );
- uservote.addEventListener( DashEvent.VOTE_DELETE, voteHandler );
- uservote.addEventListener( DashEvent.PROCESSING, voteHandler );
- }
-
- // Route all messages to the parent class.
- private function voteHandler( event:DashEvent )
- {
- if( event.type == DashEvent.VOTE_SET ) {
- setVote( event.args );
- }
-
- dispatchEvent( event );
- }
-
- // Sets the vote value.
- public function setVote( _vote:Object )
- {
- vote.setVote( _vote );
- }
-
- // Sets the tag name.
- public function setTag( tag:String ) {
- // Set the user vote tag name.
- if( uservote ) {
- uservote.setTag( tag );
- }
-
- // Set the regular vote tag name.
- if( vote ) {
- vote.setTag( tag );
- }
- }
-
- // Get both the uservote and regular vote.
- public function getVotes( nodeId:Number, cache:Boolean = false )
- {
- // Get the user vote.
- if( uservote ) {
- uservote.getVote( nodeId, cache );
- }
-
- // Get the regular vote.
- if( vote ) {
- vote.getVote( nodeId, cache );
- }
- }
-
- // Processes all cached votes.
- public function processVotes()
- {
- // Process only the user vote.
- if( uservote ) {
- uservote.processVote();
- }
- }
-
- // Declare all of our child movie clips
- public var vote:Voter;
- public var uservote:Voter;
- }
-}
+package com.tmtdigital.dash.display.voter
View
195 com/tmtdigital/dash/display/voter/Voter.as
@@ -1,194 +1 @@
-package com.tmtdigital.dash.display.voter
-{
- import com.tmtdigital.dash.display.Skinable;
- import com.tmtdigital.dash.events.DashEvent;
- import com.tmtdigital.dash.net.Service;
-
- // Import all dependencies
- import flash.display.MovieClip;
- import flash.events.MouseEvent;
-
- // Declare our Voter class.
- public class Voter extends Skinable
- {
- // The Voter constructor.
- public function Voter( _skin:MovieClip, _userMode:Boolean = false )
- {
- userMode = _userMode;
- super( _skin );
- }
-
- // Sets the skin for our voter.
- public override function setSkin( _skin:MovieClip )
- {
- super.setSkin( _skin );
- nodeId = 0;
- tag = "vote";
- cache = false;
-
- if( skin ) {
- // Set the skin elements.
- votes = skin.votes;
- voter = skin.voter;
- selected = skin.selected;
-
- if( voter && voter.fill_mc ) {
- voter.fill_mc.width = 0;
- }
-
- if( selected && selected.fill_mc ) {
- selected.fill_mc.width = 0;
- }
-
- // Set the user mode.
- setUserMode();
- }
- }
-
- // Sets the user mode for this voter.
- private function setUserMode()
- {
- if( votes ) {
- votes.visible = userMode;
- }
-
- if( voter ) {
- voter.visible = userMode;
- }
-
- if( votes && userMode ) {
- // Iterate through all the hit regions.
- var i:int = votes.numChildren;
- while (i--)
- {
- // Get the vote at this location.
- var vote:* = votes.getChildAt(i);
-
- // Setup each hit region for voting.
- vote.buttonMode = true;
- vote.mouseChildren = false;
- vote.addEventListener( MouseEvent.CLICK, onSetVote );
- vote.addEventListener( MouseEvent.MOUSE_OVER, onVoteOver );
- }
-
- // Called when the mouse exits the voter.
- skin.addEventListener( MouseEvent.MOUSE_OUT, onOut );
- }
- }
-
- // Sets the tag name.
- public function setTag( _tag:String ) {
- tag = _tag;
- }
-
- // Gets a vote from Drupal.
- public function getVote( _nodeId:Number, _cache:Boolean = false )
- {
- // Store the node Id and drupal connection.
- nodeId = _nodeId;
- cache = _cache;
-
- // Get the vote from Drupal.
- var cmd:String = userMode ? Service.GET_USER_VOTE : Service.GET_VOTE;
- Service.call( cmd, onVoteGet, null, "node", nodeId, tag );
- }
-
- // The return function from Drupal.
- private function onVoteGet( vote:Object )
- {
- // Set the selected fill width
- if( vote && selected && selected.fill_mc ) {
- selected.fill_mc.width = vote.value;
- }
-
- vote.voteType = userMode ? "userVote" : "vote";
- dispatchEvent( new DashEvent( DashEvent.VOTE_GET, vote ) );
- }
-
- // Set the selected vote.
- public function setVote( vote:Object )
- {
- // Set the selected fill width
- if( vote && selected && selected.fill_mc ) {
- selected.fill_mc.width = vote.value;
- }
- }
-
- // Called when the user makes a vote.
- private function onSetVote( event:MouseEvent )
- {
- // Get the value of the vote that was clicked.
- voteValue = event.target.name.substr(1);
-
- if( cache ) {
- setVote( {value:voteValue} );
- }
- else {
- processVote();
- }
- }
-
- // Processes the cached vote.
- public function processVote()
- {
- // Check to see if the node Id is valid.
- if( nodeId ) {
-
- // If the vote value is zero then delete the vote.
- if( voteValue == 0 ) {
- dispatchEvent( new DashEvent( DashEvent.PROCESSING ) );
- Service.call( Service.DELETE_VOTE, onVoteDelete, null, "node", nodeId, tag );
- }
- else {
- dispatchEvent( new DashEvent( DashEvent.PROCESSING ) );
- Service.call( Service.SET_VOTE, onVoteSet, null, "node", nodeId, voteValue, tag );
- }
- }
- }
-
- // The return function from Drupal.
- private function onVoteSet( vote:Object )
- {
- // Set the selected fill width
- setVote( {value: (userMode ? voteValue : vote.value)} );
- vote.voteType = userMode ? "userVote" : "vote";
- dispatchEvent( new DashEvent( DashEvent.VOTE_SET, vote ) );
- }
-
- private function onVoteDelete( vote:Object )
- {
- vote.type = userMode ? "userVote" : "vote";
- dispatchEvent( new DashEvent( DashEvent.VOTE_DELETE, vote ) );
- }
-
- // Called when the user hovers over a vote.
- private function onVoteOver( event:MouseEvent )
- {
- if( voter && voter.fill_mc ) {
- voter.fill_mc.width = event.target.name.substr(1);
- }
- }
-
- // Called when the user moves his mouse out.
- private function onOut( event:MouseEvent )
- {
- if( voter && voter.fill_mc ) {
- voter.fill_mc.width = 0;
- }
- }
-
- // Declare all of our child movie clips
- public var votes:MovieClip;
- public var selected:MovieClip;
- public var voter:MovieClip;
-
- // Keep track of what mode we are in.
- private var userMode:Boolean;
- private var cache:Boolean;
- private var voteValue:Number;
-
- // Store the node Id and vote tag.
- private var nodeId:Number;
- private var tag:String;
- }
-}
+package com.tmtdigital.dash.display.voter
View
2  com/tmtdigital/dash/net/Gateway.as
@@ -1 +1 @@
-/**
+/**
View
2  dashPlayer.js
@@ -1 +1 @@
-var dashReady=false;var dashObjects=new Array();var dashCallback=function(args){};var dashId="dashplayer";$(document).ready(function(){dashReady=true});function isDashReady(){return dashReady};function dashDebug(arg){$('#dashdebug').append(arg+"<br/>")};function getDashObject(dashId){var dashObj=null;if(dashObjects[dashId]){if(dashObjects[dashId].object){dashObj=dashObjects[dashId].object}}if(!dashObj){if(dashReady){if(navigator.appName.indexOf("Microsoft")!=-1){dashObj=window[dashId]}else{if(document[dashId].length!==undefined){dashObj=document[dashId][1]}else{dashObj=document[dashId]}}if(dashObjects[dashId]){dashObjects[dashId].object=dashObj}}}return dashObj};function dashAddObject(dashId){dashObjects[dashId]={id:dashId,ready:false,object:null}};function isDashRegistered(){var registered=true;if(dashObjects){for(var dashId in dashObjects){if(dashObjects.hasOwnProperty(dashId)){registered&=dashObjects[dashId].ready}}}return registered};function dashInitialize(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.initialize()}catch(error){dashDebug(error)}}};function startDash(){if(isDashRegistered()){for(var dashId in dashObjects){if(dashObjects.hasOwnProperty(dashId)){dashInitialize(dashId)}}}};function dashRegisterObject(dashId){if(!dashObjects.hasOwnProperty(dashId)){dashAddObject(dashId)}dashObjects[dashId].ready=true;startDash()};function dashSpawn(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.spawn()}catch(error){dashDebug(error)}return true}return false};function dashSpawnWindow(playerPath){try{window.open(playerPath)}catch(error){dashDebug(error)}};function dashLoadNode(dashId,nodeId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadNode(nodeId)}catch(error){dashDebug(error)}return true}return false};function dashLoad(dashId,file){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadMedia(file)}catch(error){dashDebug(error)}return true}return false};function dashPlay(dashId,file){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.playMedia(file)}catch(error){dashDebug(error)}return true}return false};function dashPause(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.pauseMedia()}catch(error){dashDebug(error)}return true}return false};function dashStop(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.stopMedia()}catch(error){dashDebug(error)}return true}return false};function dashSeek(dashId,seekTime){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setSeek(seekTime)}catch(error){dashDebug(error)}return true}return false};function dashVolume(dashId,vol){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setVolume(vol)}catch(error){dashDebug(error)}return true}return false};function dashGetVolume(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{return dashObj.getVolume()}catch(error){dashDebug(error)}}return 0};function dashSetFullScreen(dashId,full){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setFullScreen(full)}catch(error){dashDebug(error)}return true}return false};function dashSetMaximize(dashId,max,tween){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setMaximize(max,tween)}catch(error){dashDebug(error)}return true}return false};function dashSetMenu(dashId,menu,tween){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setMenu(menu,tween)}catch(error){dashDebug(error)}return true}return false};function dashIsNodeLoaded(dashId){var dashObj=getDashObject(dashId);if(dashObj){return(dashObj.isNodeLoaded())}return false};function dashLoadPlaylist(dashId,playlist){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadPlaylist(playlist)}catch(error){dashDebug(error)}return true}return false};function dashLoadPrev(dashId,loop,playAfter){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadPrev(loop,playAfter)}catch(error){dashDebug(error)}return true}return false};function dashLoadNext(dashId,loop,playAfter){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadNext(loop,playAfter)}catch(error){dashDebug(error)}return true}return false};function dashPrevPage(dashId,loop){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.prevPage(loop)}catch(error){dashDebug(error)}return true}return false};function dashNextPage(dashId,loop){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.nextPage(loop)}catch(error){dashDebug(error)}return true}return false};function dashSetFilter(dashId,argument,index){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setFilter(argument,index)}catch(error){dashDebug(error)}return true}return false};function dashSetPlaylist(dashId,message){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setPlaylist(message)}catch(error){dashDebug(error)}return true}return false};function dashSetPlaylistVote(dashId,nodeId,vote){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setPlaylistVote(nodeId,vote)}catch(error){dashDebug(error)}return true}return false};function dashSetVote(dashId,vote){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setVote(vote)}catch(error){dashDebug(error)}return true}return false};function dashResetControls(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.resetControls();return true}return false};function dashEnableControls(dashId,enable){var dashObj=getDashObject(dashId);if(dashObj){dashObj.enableControls(enable);return true}return false};function dashSetControlState(dashId,state){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlState(state);return true}return false};function dashSetControlTime(dashId,time){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlTime(time);return true}return false};function dashSetControlVolume(dashId,volume){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlVolume(volume);return true}return false};function dashSetControlProgress(dashId,progress){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlProgress(progress);return true}return false};function dashSetControlSeek(dashId,seek){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlSeek(seek);return true}return false};function dashControlUpdate(dashId,playTime,totalTime){var dashObj=getDashObject(dashId);if(dashObj){dashObj.controlUpdate(playTime,totalTime);return true}return false};function dashSetSkin(dashId,skin){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setSkin(skin);return true}return false};function dashServiceCall(){var dashId=arguments[0];arguments.shift();var command=arguments[0];arguments.shift();dashCallback=arguments[0];arguments.shift();var dashObj=getDashObject(dashId);if(dashObj){dashObj.serviceCall(command,arguments);return true}return false};function dashServiceReturn(args){dashCallback(args)};function onYouTubePlayerReady(playerId){dashId=playerId;var dashObj=getDashObject(playerId);if(dashObj){try{dashObj.addEventListener("onStateChange","youTubeOnStateChange");dashObj.addEventListener("onError","youTubeOnError");dashObj.onYouTubeReady()}catch(error){dashDebug(error)}}};function youTubeOnStateChange(newState){var dashObj=getDashObject(dashId);if(dashObj){dashObj.onYouTubeStateChange(newState)}};function youTubeOnError(error){var dashObj=getDashObject(dashId);if(dashObj){dashObj.onYouTubeError(error)}};function youTubeLoad(dashId,youTubeId,startSeconds){var dashObj=getDashObject(dashId);if(dashObj){dashObj.loadVideoById(youTubeId,startSeconds)}};function youTubeCue(dashId,youTubeId,startSeconds){var dashObj=getDashObject(dashId);if(dashObj){dashObj.cueVideoById(youTubeId,startSeconds)}};function youTubeDestroy(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.destroy()}};function youTubeClear(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.clearVideo()}};function youTubeSetSize(dashId,_width,_height){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setSize(_width,_height)}};function youTubePlay(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.playVideo()}};function youTubePause(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.pauseVideo()}};function youTubeStop(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.stopVideo()}};function youTubeSeek(dashId,seconds,allowSeekAhead){var dashObj=getDashObject(dashId);if(dashObj){dashObj.seekTo(seconds,allowSeekAhead)}};function youTubeGetBytesLoaded(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVideoBytesLoaded()}return 0};function youTubeGetBytesTotal(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVideoBytesTotal()}return 0};function youTubeGetCurrentTime(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getCurrentTime()}return 0};function youTubeGetDuration(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getDuration()}return 0};function youTubeSetVolume(dashId,newVolume){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setVolume(newVolume)}};function youTubeGetVolume(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVolume()}return 0};function youTubeGetEmbedCode(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getEmbedCode()}return""};function youTubeGetVideoUrl(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVideoUrl()}return""};
+var dashReady=false;var dashObjects=new Array();var dashCallback=function(args){};var dashId="dashplayer";$(document).ready(function(){dashReady=true});function isDashReady(){return dashReady};function dashDebug(arg){$('#dashdebug').append(arg+"<br/>")};function getDashObject(dashId){var dashObj=null;if(dashObjects[dashId]){if(dashObjects[dashId].object){dashObj=dashObjects[dashId].object}}if(!dashObj){if(dashReady){if(navigator.appName.indexOf("Microsoft")!=-1){dashObj=window[dashId]}else{if(document[dashId].length!==undefined){dashObj=document[dashId][1]}else{dashObj=document[dashId]}}if(dashObjects[dashId]){dashObjects[dashId].object=dashObj}}}return dashObj};function dashAddObject(dashId){dashObjects[dashId]={id:dashId,ready:false,object:null}};function isDashRegistered(){var registered=true;if(dashObjects){for(var dashId in dashObjects){if(dashObjects.hasOwnProperty(dashId)){registered&=dashObjects[dashId].ready}}}return registered};function dashInitialize(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.initialize()}catch(error){dashDebug(error)}}};function startDash(){if(isDashRegistered()){for(var dashId in dashObjects){if(dashObjects.hasOwnProperty(dashId)){dashInitialize(dashId)}}}};function dashRegisterObject(dashId){if(!dashObjects.hasOwnProperty(dashId)){dashAddObject(dashId)}dashObjects[dashId].ready=true;startDash()};function dashSpawn(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.spawn()}catch(error){dashDebug(error)}return true}return false};function dashSpawnWindow(playerPath){try{window.open(playerPath)}catch(error){dashDebug(error)}};function dashLoadNode(dashId,nodeId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadNode(nodeId)}catch(error){dashDebug(error)}return true}return false};function dashLoad(dashId,file){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadMedia(file)}catch(error){dashDebug(error)}return true}return false};function dashPlay(dashId,file){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.playMedia(file)}catch(error){dashDebug(error)}return true}return false};function dashPause(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.pauseMedia()}catch(error){dashDebug(error)}return true}return false};function dashStop(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.stopMedia()}catch(error){dashDebug(error)}return true}return false};function dashSeek(dashId,seekTime){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setSeek(seekTime)}catch(error){dashDebug(error)}return true}return false};function dashVolume(dashId,vol){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setVolume(vol)}catch(error){dashDebug(error)}return true}return false};function dashGetVolume(dashId){var dashObj=getDashObject(dashId);if(dashObj){try{return dashObj.getVolume()}catch(error){dashDebug(error)}}return 0};function dashSetFullScreen(dashId,full){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setFullScreen(full)}catch(error){dashDebug(error)}return true}return false};function dashSetMaximize(dashId,max,tween){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setMaximize(max,tween)}catch(error){dashDebug(error)}return true}return false};function dashSetMenu(dashId,menu,tween){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setMenu(menu,tween)}catch(error){dashDebug(error)}return true}return false};function dashIsNodeLoaded(dashId){var dashObj=getDashObject(dashId);if(dashObj){return(dashObj.isNodeLoaded())}return false};function dashLoadPlaylist(dashId,playlist){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadPlaylist(playlist)}catch(error){dashDebug(error)}return true}return false};function dashLoadPrev(dashId,loop,playAfter){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadPrev(loop,playAfter)}catch(error){dashDebug(error)}return true}return false};function dashLoadNext(dashId,loop,playAfter){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.loadNext(loop,playAfter)}catch(error){dashDebug(error)}return true}return false};function dashPrevPage(dashId,loop){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.prevPage(loop)}catch(error){dashDebug(error)}return true}return false};function dashNextPage(dashId,loop){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.nextPage(loop)}catch(error){dashDebug(error)}return true}return false};function dashSetFilter(dashId,argument,index){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setFilter(argument,index)}catch(error){dashDebug(error)}return true}return false};function dashSetPlaylist(dashId,message){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setPlaylist(message)}catch(error){dashDebug(error)}return true}return false};function dashSetPlaylistVote(dashId,nodeId,vote){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setPlaylistVote(nodeId,vote)}catch(error){dashDebug(error)}return true}return false};function dashSetPlaylistUserVote(dashId,nodeId,vote){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setPlaylistUserVote(nodeId,vote)}catch(error){dashDebug(error)}return true}return false};function dashSetVote(dashId,vote){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setVote(vote)}catch(error){dashDebug(error)}return true}return false};function dashSetUserVote(dashId,vote){var dashObj=getDashObject(dashId);if(dashObj){try{dashObj.setUserVote(vote)}catch(error){dashDebug(error)}return true}return false};function dashResetControls(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.resetControls();return true}return false};function dashEnableControls(dashId,enable){var dashObj=getDashObject(dashId);if(dashObj){dashObj.enableControls(enable);return true}return false};function dashSetControlState(dashId,state){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlState(state);return true}return false};function dashSetControlTime(dashId,time){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlTime(time);return true}return false};function dashSetControlVolume(dashId,volume){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlVolume(volume);return true}return false};function dashSetControlProgress(dashId,progress){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlProgress(progress);return true}return false};function dashSetControlSeek(dashId,seek){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setControlSeek(seek);return true}return false};function dashControlUpdate(dashId,playTime,totalTime){var dashObj=getDashObject(dashId);if(dashObj){dashObj.controlUpdate(playTime,totalTime);return true}return false};function dashSetSkin(dashId,skin){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setSkin(skin);return true}return false};function dashServiceCall(){var dashId=arguments[0];arguments.shift();var command=arguments[0];arguments.shift();dashCallback=arguments[0];arguments.shift();var dashObj=getDashObject(dashId);if(dashObj){dashObj.serviceCall(command,arguments);return true}return false};function dashServiceReturn(args){dashCallback(args)};function onYouTubePlayerReady(playerId){dashId=playerId;var dashObj=getDashObject(playerId);if(dashObj){try{dashObj.addEventListener("onStateChange","youTubeOnStateChange");dashObj.addEventListener("onError","youTubeOnError");dashObj.onYouTubeReady()}catch(error){dashDebug(error)}}};function youTubeOnStateChange(newState){var dashObj=getDashObject(dashId);if(dashObj){dashObj.onYouTubeStateChange(newState)}};function youTubeOnError(error){var dashObj=getDashObject(dashId);if(dashObj){dashObj.onYouTubeError(error)}};function youTubeLoad(dashId,youTubeId,startSeconds){var dashObj=getDashObject(dashId);if(dashObj){dashObj.loadVideoById(youTubeId,startSeconds)}};function youTubeCue(dashId,youTubeId,startSeconds){var dashObj=getDashObject(dashId);if(dashObj){dashObj.cueVideoById(youTubeId,startSeconds)}};function youTubeDestroy(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.destroy()}};function youTubeClear(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.clearVideo()}};function youTubeSetSize(dashId,_width,_height){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setSize(_width,_height)}};function youTubePlay(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.playVideo()}};function youTubePause(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.pauseVideo()}};function youTubeStop(dashId){var dashObj=getDashObject(dashId);if(dashObj){dashObj.stopVideo()}};function youTubeSeek(dashId,seconds,allowSeekAhead){var dashObj=getDashObject(dashId);if(dashObj){dashObj.seekTo(seconds,allowSeekAhead)}};function youTubeGetBytesLoaded(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVideoBytesLoaded()}return 0};function youTubeGetBytesTotal(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVideoBytesTotal()}return 0};function youTubeGetCurrentTime(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getCurrentTime()}return 0};function youTubeGetDuration(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getDuration()}return 0};function youTubeSetVolume(dashId,newVolume){var dashObj=getDashObject(dashId);if(dashObj){dashObj.setVolume(newVolume)}};function youTubeGetVolume(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVolume()}return 0};function youTubeGetEmbedCode(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getEmbedCode()}return""};function youTubeGetVideoUrl(dashId){var dashObj=getDashObject(dashId);if(dashObj){return dashObj.getVideoUrl()}return""};
View
38 dashPlayerFull.js
@@ -556,6 +556,25 @@ function dashSetPlaylistVote( dashId, nodeId, vote ) {
};
/**
+ * Sets the user vote of the playlist.
+ *
+ * @param - The ID of the player you would like to send this request too.
+ * @param - The message object that you would like to use to provide to the playlist.
+ */
+function dashSetPlaylistUserVote( dashId, nodeId, vote ) {
+ var dashObj = getDashObject( dashId );
+ if( dashObj ) {
+ try {
+ dashObj.setPlaylistUserVote( nodeId, vote );
+ } catch( error ) {
+ dashDebug( error );
+ }
+ return true;
+ }
+ return false;
+};
+
+/**
* Sets the vote of the node.
*
* @param - The ID of the player you would like to send this request too.
@@ -575,6 +594,25 @@ function dashSetVote( dashId, vote ) {
};
/**
+ * Sets the user vote of the node.
+ *
+ * @param - The ID of the player you would like to send this request too.
+ * @param - The message object that you would like to use to provide to the playlist.
+ */
+function dashSetUserVote( dashId, vote ) {
+ var dashObj = getDashObject( dashId );
+ if( dashObj ) {
+ try {
+ dashObj.setUserVote( vote );
+ } catch( error ) {
+ dashDebug( error );
+ }
+ return true;
+ }
+ return false;
+};
+
+/**
* Resets the controls.
*
* @param - The ID of the player you would like to send this request too.
Please sign in to comment.
Something went wrong with that request. Please try again.