From 11ada8a083d93393bb0a743ba70ed22200a8995f Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Sun, 15 Feb 2015 21:13:54 -0500 Subject: [PATCH 01/31] Got the jPlayer driver to load... --- support/client/lib/vwf.js | 2 + support/client/lib/vwf/view/jPlayer.js | 71 ++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100755 support/client/lib/vwf/view/jPlayer.js diff --git a/support/client/lib/vwf.js b/support/client/lib/vwf.js index 36e3e758a..29e4bfca1 100644 --- a/support/client/lib/vwf.js +++ b/support/client/lib/vwf.js @@ -405,6 +405,7 @@ { library: "vwf/view/cesium", active: false }, { library: "vwf/view/kineticjs", active: false }, { library: "vwf/view/mil-sym", active: false }, + { library: "vwf/view/jPlayer", linkedLibraries: ["vwf/model/jPlayer.2.7.1/jquery.jplayer.min"], active: false }, { library: "vwf/view/audio", active: false }, { library: "vwf/kernel/utility", active: true }, { library: "vwf/utility", active: true }, @@ -460,6 +461,7 @@ { library: "vwf/view/touch", active: false }, { library: "vwf/view/kineticjs", active: false }, { library: "vwf/view/mil-sym", active: false }, + { library: "vwf/view/jPlayer", active: false }, { library: "vwf/view/audio", active: false }, { library: "vwf/view/webrtc", active: false} ] diff --git a/support/client/lib/vwf/view/jPlayer.js b/support/client/lib/vwf/view/jPlayer.js new file mode 100755 index 000000000..8144e518c --- /dev/null +++ b/support/client/lib/vwf/view/jPlayer.js @@ -0,0 +1,71 @@ +/// vwf/view/jPlayer.js is a sound/video driver +/// +/// @module vwf/model/jPlayer +/// @requires vwf/model + +define( [ + "module", + "vwf/view", + "jquery" + ], function( module, view, $ ) { + return view.load( module, { + createdProperty: function (nodeID, propertyName, propertyValue) { + this.satProperty(nodeID, propertyName, propertyValue); + }, + + initializedProperty: function ( nodeID, propertyName, propertyValue ) { + this.satProperty(nodeID, propertyName, propertyValue); + }, + + calledMethod: function( nodeID, methodName, methodParameters, methodValue ) { + var node = this.state.nodes[nodeID]; + + if( node ){ + var containerSelector = "#" + node.containerDivId; + var playerSelector = "#" + node.playerDivId; + + switch ( methodName ){ + //We cannot safely call .show() or .hide() on the jPlayer div + //See http://jplayer.org/latest/developer-guide/#jPlayer-disable-by-css + case "show": + var contX = node.containerSize[0]; + var contY = node.containerSize[1]; + var playerX = node.playerSize[0]; + var playerY = node.playerSize[1]; + + $( containerSelector ).css('width', contX); + $( containerSelector ).css('height', contY); + $( playerSelector ).css('width', playerX); + $( playerSelector ).css('height', playerY); + break; + + case "hide": + $( containerSelector ).css('width', 0); + $( containerSelector ).css('height', 0); + $( playerSelector ).css('width', 0); + $( playerSelector ).css('height', 0); + break; + } + } + }, + + satProperty: function ( nodeID, propertyName, propertyValue ) { + var node = this.state.nodes[nodeID]; + if( node && propertyValue ){ + switch( propertyName ){ + case "z_index": + var containerSelector = "#" + node.containerDivId; + $(containerSelector).css('z-index', propertyValue); + break; + case "containerDivSize": + node.containerDivSize = propertyValue; + break; + case "playerDivSize": + node.playerDivSize = propertyValue; + break; + } + } + } + }); + } +); \ No newline at end of file From 17223124e7f4645869cd2f72d3c788f46f1777c0 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Sun, 15 Feb 2015 21:18:58 -0500 Subject: [PATCH 02/31] Got the new videoManager dropped in. Doesn't break TDG. --- .../vwf.example.com/jplayer/videoManager.vwf.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml index dd8c6dd7c..a688233d2 100644 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -6,8 +6,14 @@ properties: loop: false containerDivId: "videoContainer" playerDivId: "videoScreen" + containerSize: [ 1024, 768 ] + playerSize: [1024, 768] methods: - play: + play: pause: - stop: - \ No newline at end of file + stop: + show: + hide: + clearMedia: +events: + videoEnded: \ No newline at end of file From d433d90ac70c7bf3d59689313c278de9480071b0 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Sun, 15 Feb 2015 22:04:39 -0500 Subject: [PATCH 03/31] Got the changes to the jPlayer model driver merged in. It loads and nothing breaks horifically. --- support/client/lib/vwf/model/jPlayer.js | 41 +++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 6debc886e..7aa082296 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -1,4 +1,4 @@ -/// vwf/model/jPlayer.js is a sound driver +/// vwf/model/jPlayer.js is a sound/video driver /// /// @module vwf/model/jPlayer /// @requires vwf/model @@ -203,6 +203,7 @@ define( [ setLoop( node, propertyValue ); value = node.loop; break; + case "playerDivId": if ( propertyValue === node.playerDivId ) { break; @@ -233,8 +234,14 @@ define( [ setControlDivId( node, node.containerDivId ); } }, - supplied: fileTypes + supplied: fileTypes, + // size: { width: node.playmoderDivSize[0], height: node.playerDivSize[1] } } ); + + if ( node.playerDivId ) { + $( "#" + node.playerDivId ).bind($.jPlayer.event.ended, videoEndedCallback ); + } + value = node.playerDivId; break; case "containerDivId": @@ -245,6 +252,14 @@ define( [ setPosterImageUrl( node, propertyValue ); value = node.posterImageUrl; break; + case "playerSize": + setPlayerSize( node, propertyValue ); + value = node.playerSize; + break; + case "containerSize": + setContainerSize( node, propertyValue ); + value = node.containerSize; + break; default: break; } @@ -334,6 +349,9 @@ define( [ node.jPlayerElement.jPlayer( "stop" ); break; + case "clearMedia": + node.jPlayerElement.jPlayer( "clearMedia" ); + break; } } @@ -342,6 +360,13 @@ define( [ } ); + function videoEndedCallback(){ + var mediaManagerID = vwf.find( undefined, "/mediaManager" )[ 0 ]; + var videoManagerID = vwf.find( mediaManagerID, "videoManager" ) [ 0 ]; + console.log("Video ended callback in driver fired!"); + vwf.fireEvent(videoManagerID, "videoEnded"); + } + function getPrototypes( kernel, extendsID ) { var prototypes = []; var id = extendsID; @@ -403,7 +428,7 @@ define( [ } break; case "video": - if ( url.search( "data:video/mp4" ) === 0 ) { + if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { mediaObject = { m4v: url, poster: node.posterImageUrl @@ -454,4 +479,14 @@ define( [ } ); } } + + function setPlayerSize( node, playerSize ){ + node.playerSize = playerSize; + node.jPlayerElement.jPlayer( "option", "size", {width: playerSize[0], height: playerSize[1]}); + } + + function setContainerSize( node, containerSize ){ + node.containerSize = containerSize; + } + } ); From ef5613da567eb672bdaf00b1671c7583eabb9596 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Tue, 17 Feb 2015 12:08:32 -0500 Subject: [PATCH 04/31] Removed unnecessary method which sets z-index. --- support/client/lib/vwf/view/jPlayer.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/support/client/lib/vwf/view/jPlayer.js b/support/client/lib/vwf/view/jPlayer.js index 8144e518c..834b78b3c 100755 --- a/support/client/lib/vwf/view/jPlayer.js +++ b/support/client/lib/vwf/view/jPlayer.js @@ -53,10 +53,6 @@ define( [ var node = this.state.nodes[nodeID]; if( node && propertyValue ){ switch( propertyName ){ - case "z_index": - var containerSelector = "#" + node.containerDivId; - $(containerSelector).css('z-index', propertyValue); - break; case "containerDivSize": node.containerDivSize = propertyValue; break; From 42a167690f6b27fafdf607bb9baadc447d45816d Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Tue, 17 Feb 2015 12:42:20 -0500 Subject: [PATCH 05/31] Debugged calling "play" along with passing in the URL. --- support/client/lib/vwf/model/jPlayer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 7aa082296..ba956ea3c 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -338,6 +338,10 @@ define( [ switch( methodName ) { case "play": + + if( methodParameters ){ + vwf.setProperty( node.ID, "url", methodParameters ); + } node.jPlayerElement.jPlayer( "play" ); break; From 12a23ccbc06acfe4651605ac4eee026ef4c01b4b Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Thu, 19 Feb 2015 13:35:14 -0500 Subject: [PATCH 06/31] Got more stuff using "vwf." rather than this.kernel. --- support/client/lib/vwf/model/jPlayer.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index ba956ea3c..ddc164a47 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -67,7 +67,13 @@ define( [ } } return found; - } + }, + "videoEndedCallback" : function() { + var mediaManagerID = modelDriver.kernel.find( undefined, "/mediaManager" )[ 0 ]; + var videoManagerID = modelDriver.kernel.find( mediaManagerID, "videoManager" ) [ 0 ]; + console.log("Video ended callback in driver fired!"); + modelDriver.kernel.fireEvent(videoManagerID, "videoEnded"); + }, }; // turns on logger debugger console messages @@ -239,7 +245,7 @@ define( [ } ); if ( node.playerDivId ) { - $( "#" + node.playerDivId ).bind($.jPlayer.event.ended, videoEndedCallback ); + $( "#" + node.playerDivId ).bind($.jPlayer.event.ended, this.state.videoEndedCallback ); } value = node.playerDivId; @@ -316,7 +322,6 @@ define( [ return node && node[ propertyName ]; }, - // TODO: deletingMethod // -- callingMethod -------------------------------------------------------------------------- @@ -340,7 +345,7 @@ define( [ case "play": if( methodParameters ){ - vwf.setProperty( node.ID, "url", methodParameters ); + this.kernel.setProperty( node.ID, "url", methodParameters ); } node.jPlayerElement.jPlayer( "play" ); break; @@ -364,12 +369,12 @@ define( [ } ); - function videoEndedCallback(){ - var mediaManagerID = vwf.find( undefined, "/mediaManager" )[ 0 ]; - var videoManagerID = vwf.find( mediaManagerID, "videoManager" ) [ 0 ]; - console.log("Video ended callback in driver fired!"); - vwf.fireEvent(videoManagerID, "videoEnded"); - } + // function videoEndedCallback(){ + // var mediaManagerID = this.kernel.kernel.find( undefined, "/mediaManager" )[ 0 ]; + // var videoManagerID = this.kernel.kernel.find( mediaManagerID, "videoManager" ) [ 0 ]; + // console.log("Video ended callback in driver fired!"); + // this.kernel.fireEvent(videoManagerID, "videoEnded"); + // } function getPrototypes( kernel, extendsID ) { var prototypes = []; From c6b6baee2fec55f40ea2c8cd8fbaec2553fba87b Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Thu, 19 Feb 2015 13:51:23 -0500 Subject: [PATCH 07/31] Now it appears that we can inject divs dynamically? --- support/client/lib/vwf/model/jPlayer.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index ddc164a47..4fc2e4ede 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -22,6 +22,15 @@ define( [ // -- initialize --------------------------------------------------------------------------- initialize: function( options ) { + + var containerDiv = document.createElement( 'div' ); + containerDiv.id = "jp_container_1"; + containerDiv.className = "jp-video jp-video-360p"; + var playerDiv = document.createElement( 'div' ); + playerDiv.id = "jquery_jplayer_1"; + playerDiv.className = "jp-jplayer"; + containerDiv.appendChild( playerDiv ); + $( "body" ).append(containerDiv); modelDriver = this; From 93b46ab319b9c0fae094fb8fa0bf7f301e6ac180 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Thu, 19 Feb 2015 19:29:32 -0500 Subject: [PATCH 08/31] Div injection now works (I think?) --- support/client/lib/vwf/model/jPlayer.js | 37 ++++++++++++++----- .../jplayer/videoManager.vwf.yaml | 4 +- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 4fc2e4ede..fad17b353 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -12,8 +12,9 @@ define( [ var modelDriver; var jPlayerInstanceCreated = false; - var audioManagerProtoId = "http://vwf.example.com/jplayer/audioManager.vwf"; - var videoManagerProtoId = "http://vwf.example.com/jplayer/videoManager.vwf"; + var audioManagerProtoId = "http-vwf-example-com-jplayer-audioManager-vwf"; + var videoManagerProtoId = "http-vwf-example-com-jplayer-videoManager-vwf"; + var jplayerContainerId = "jp_container_1"; return model.load( module, { @@ -24,7 +25,7 @@ define( [ initialize: function( options ) { var containerDiv = document.createElement( 'div' ); - containerDiv.id = "jp_container_1"; + containerDiv.id = jplayerContainerId; containerDiv.className = "jp-video jp-video-360p"; var playerDiv = document.createElement( 'div' ); playerDiv.id = "jquery_jplayer_1"; @@ -231,10 +232,26 @@ define( [ if ( $existingElement.length ) { node.jPlayerElement = $existingElement; } else { - node.jPlayerElement = $( "
", { - id: node.playerDivId - } ); - $( "body" ).append( node.jPlayerElement ); + //Change the existing element to match the new name + var playerDiv = document.createElement( 'div' ); + playerDiv.id = node.playerDivId; + if( node.containerDivId ){ + // playerDiv.className = "jp-jplayer"; + $( "#" + node.containerDivId ).append( playerDiv ); + } else { + $("#jp_container_1").append( playerDiv ); + } + node.jPlayerElement = $( "#" + node.playerDivId ); + + // $( "#" + jplayerContainerId ).jPlayer("option", "cssSelectorAncestor", "#" + node.playerDivId); + // $( "#" + jplayerContainerId ).attr( "id", node.playerDivId ); + // jplayerContainerId = node.playerDivId; + + // node.jPlayerElement = $( "#" + node.playerDivId ); + // node.jPlayerElement = $( "
", { + // id: node.playerDivId + // } ); + // $( "body" ).append( node.jPlayerElement ); } var fileTypes = ( node.managerType === "audio" ) ? "mp3,wav" : "m4v"; node.jPlayerElement.jPlayer( { @@ -483,9 +500,9 @@ define( [ function setControlDivId( node, containerDivId ) { node.containerDivId = containerDivId; - if ( node.jPlayerElement ) { - node.jPlayerElement.jPlayer( "option", { cssSelectorAncestor: "#" + containerDivId } ); - } + // if ( node.jPlayerElement ) { + // node.jPlayerElement.jPlayer( "option", { cssSelectorAncestor: "#" + containerDivId } ); + // } } function setPosterImageUrl( node, posterImageUrl ) { diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml index a688233d2..a8b203c63 100644 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -4,8 +4,10 @@ properties: url: posterImageUrl: loop: false - containerDivId: "videoContainer" + containerDivId: "jp_container_1" playerDivId: "videoScreen" + # containerDivId: "videoContainer" + # playerDivId: "videoScreen" containerSize: [ 1024, 768 ] playerSize: [1024, 768] methods: From febf0212edd52b387a06b56dba14107aabcd60d6 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Thu, 19 Feb 2015 19:34:43 -0500 Subject: [PATCH 09/31] Changed default names of jPlayer div container and player container BACK so that TDG doesn't break! --- support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml index a8b203c63..a688233d2 100644 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -4,10 +4,8 @@ properties: url: posterImageUrl: loop: false - containerDivId: "jp_container_1" + containerDivId: "videoContainer" playerDivId: "videoScreen" - # containerDivId: "videoContainer" - # playerDivId: "videoScreen" containerSize: [ 1024, 768 ] playerSize: [1024, 768] methods: From 260328902c47ce27fadb6edce3bfe25a3cd3d8b7 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Fri, 20 Feb 2015 12:15:19 -0500 Subject: [PATCH 10/31] Corrected tabs vs spaces in the view driver. --- support/client/lib/vwf/view/jPlayer.js | 10 +++++----- .../vwf.example.com/jplayer/videoManager.vwf.yaml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/support/client/lib/vwf/view/jPlayer.js b/support/client/lib/vwf/view/jPlayer.js index 834b78b3c..389b3f590 100755 --- a/support/client/lib/vwf/view/jPlayer.js +++ b/support/client/lib/vwf/view/jPlayer.js @@ -8,7 +8,7 @@ define( [ "vwf/view", "jquery" ], function( module, view, $ ) { - return view.load( module, { + return view.load( module, { createdProperty: function (nodeID, propertyName, propertyValue) { this.satProperty(nodeID, propertyName, propertyValue); }, @@ -49,7 +49,7 @@ define( [ } }, - satProperty: function ( nodeID, propertyName, propertyValue ) { + satProperty: function ( nodeID, propertyName, propertyValue ) { var node = this.state.nodes[nodeID]; if( node && propertyValue ){ switch( propertyName ){ @@ -61,7 +61,7 @@ define( [ break; } } - } - }); + } + }); } -); \ No newline at end of file +); diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml index a688233d2..d22358976 100644 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -7,7 +7,7 @@ properties: containerDivId: "videoContainer" playerDivId: "videoScreen" containerSize: [ 1024, 768 ] - playerSize: [1024, 768] + playerSize: [ 1024, 768 ] methods: play: pause: From 4de359ef918d041db458d35e3c868c4c2b8d06fa Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Wed, 25 Feb 2015 16:08:27 -0500 Subject: [PATCH 11/31] Fix prototype ids for jPlayer --- support/client/lib/vwf/model/jPlayer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index fad17b353..857e5d044 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -12,8 +12,8 @@ define( [ var modelDriver; var jPlayerInstanceCreated = false; - var audioManagerProtoId = "http-vwf-example-com-jplayer-audioManager-vwf"; - var videoManagerProtoId = "http-vwf-example-com-jplayer-videoManager-vwf"; + var audioManagerProtoId = "http://vwf.example.com/jplayer/audioManager.vwf"; + var videoManagerProtoId = "http://vwf.example.com/jplayer/videoManager.vwf"; var jplayerContainerId = "jp_container_1"; return model.load( module, { From 8eb23d261af0b35bf1b464cd910de4cfc3901226 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Thu, 19 Feb 2015 19:29:32 -0500 Subject: [PATCH 12/31] Div injection now works (I think?) --- support/client/lib/vwf/model/jPlayer.js | 4 ++-- support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 857e5d044..fad17b353 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -12,8 +12,8 @@ define( [ var modelDriver; var jPlayerInstanceCreated = false; - var audioManagerProtoId = "http://vwf.example.com/jplayer/audioManager.vwf"; - var videoManagerProtoId = "http://vwf.example.com/jplayer/videoManager.vwf"; + var audioManagerProtoId = "http-vwf-example-com-jplayer-audioManager-vwf"; + var videoManagerProtoId = "http-vwf-example-com-jplayer-videoManager-vwf"; var jplayerContainerId = "jp_container_1"; return model.load( module, { diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml index d22358976..2f6c0cc2c 100644 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -4,8 +4,10 @@ properties: url: posterImageUrl: loop: false - containerDivId: "videoContainer" + containerDivId: "jp_container_1" playerDivId: "videoScreen" + # containerDivId: "videoContainer" + # playerDivId: "videoScreen" containerSize: [ 1024, 768 ] playerSize: [ 1024, 768 ] methods: From 5f1b30878f30cb0c669a2b0e7611d07c577ec480 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Thu, 26 Feb 2015 18:18:13 -0500 Subject: [PATCH 13/31] Instead of creating a new mediaObject for every case of file format, we now create a single mediaObject and augment as necessary. --- support/client/lib/vwf/model/jPlayer.js | 26 ++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index fad17b353..ba1ae4ec2 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -446,17 +446,19 @@ define( [ if ( url ) { // Construct the media object based on the type of file being passed in - var mediaObject; + var mediaObject = {}; switch ( node.managerType ) { case "audio": if ( url.search( "data:audio/mp3" ) === 0 ) { - mediaObject = { - mp3: url - }; + medaObject.mp3 = url; + // mediaObject = { + // mp3: url + // }; } else if ( url.search( "data:audio/wav" ) === 0 ) { - mediaObject = { - wav: url - }; + mediaObject.wav = url; + // mediaObject = { + // wav: url + // }; } else { modelDriver.logger.errorx( "setUrl", "Unsupported sound type for '", url, "'" ); @@ -464,10 +466,12 @@ define( [ break; case "video": if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { - mediaObject = { - m4v: url, - poster: node.posterImageUrl - }; + mediaObject.poster = node.posterImageUrl; + mediaObject.m4v = url; + // mediaObject = { + // m4v: url, + // poster: node.posterImageUrl + // }; } else { modelDriver.logger.errorx( "setUrl", "Unsupported video type for '", url, "'" ); From 159f2e0b86147720a0d899cd3862ed03a68d28c5 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Fri, 27 Feb 2015 00:39:39 -0500 Subject: [PATCH 14/31] Beginnings of consuming an array of video input URLs is there... --- support/client/lib/vwf/model/jPlayer.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index ba1ae4ec2..06f9e011d 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -257,7 +257,7 @@ define( [ node.jPlayerElement.jPlayer( { ready: function() { if ( node.url !== undefined ) { - setUrl( node, node.url ); + setUrl( node, [ node.url ] ); } if ( node.loop !== undefined ) { setLoop( node, node.loop ); @@ -432,7 +432,8 @@ define( [ } } - function setUrl( node, url ) { + function setUrl( node, urlArray ) { + var url = urlArray[ 0 ]; node.url = url; // If there is no jPlayerElement, there is nothing to do yet so we return. @@ -449,16 +450,11 @@ define( [ var mediaObject = {}; switch ( node.managerType ) { case "audio": + //TODO: Support multiple URLs for audio. if ( url.search( "data:audio/mp3" ) === 0 ) { medaObject.mp3 = url; - // mediaObject = { - // mp3: url - // }; } else if ( url.search( "data:audio/wav" ) === 0 ) { mediaObject.wav = url; - // mediaObject = { - // wav: url - // }; } else { modelDriver.logger.errorx( "setUrl", "Unsupported sound type for '", url, "'" ); @@ -468,10 +464,6 @@ define( [ if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { mediaObject.poster = node.posterImageUrl; mediaObject.m4v = url; - // mediaObject = { - // m4v: url, - // poster: node.posterImageUrl - // }; } else { modelDriver.logger.errorx( "setUrl", "Unsupported video type for '", url, "'" ); From ad03d939472797335f0266ea7039c0280e35b388 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Fri, 27 Feb 2015 01:05:19 -0500 Subject: [PATCH 15/31] Adding multi-format support appears to work! --- support/client/lib/vwf/model/jPlayer.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 06f9e011d..39baa179e 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -253,11 +253,11 @@ define( [ // } ); // $( "body" ).append( node.jPlayerElement ); } - var fileTypes = ( node.managerType === "audio" ) ? "mp3,wav" : "m4v"; + var fileTypes = ( node.managerType === "audio" ) ? "mp3,wav" : "m4v,webmv"; node.jPlayerElement.jPlayer( { ready: function() { if ( node.url !== undefined ) { - setUrl( node, [ node.url ] ); + setUrl( node, node.url ); } if ( node.loop !== undefined ) { setLoop( node, node.loop ); @@ -461,12 +461,16 @@ define( [ } break; case "video": - if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { - mediaObject.poster = node.posterImageUrl; - mediaObject.m4v = url; - } else { - modelDriver.logger.errorx( "setUrl", - "Unsupported video type for '", url, "'" ); + mediaObject.poster = node.posterImageUrl; + for( var i = 0; i < urlArray.length; i++ ){ + if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { + mediaObject.m4v = urlArray[ i ]; + }else if( url.search( ".webm$" ) > -1 ){ + mediaObject.webmv = urlArray[ i ]; + } else { + modelDriver.logger.errorx( "setUrl", + "Unsupported video type for '", url, "'" ); + } } break; default: From 3a0a2fb754b7ac15451028ce8b7649ba7831a6cc Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Fri, 27 Feb 2015 15:51:53 -0500 Subject: [PATCH 16/31] Now, mars-game appears to pass both test cases: playing on a browser without h.264 support, but with webM support (Chromium) and vice versa (Safari) --- support/client/lib/vwf/model/jPlayer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 39baa179e..52a77a73b 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -463,9 +463,9 @@ define( [ case "video": mediaObject.poster = node.posterImageUrl; for( var i = 0; i < urlArray.length; i++ ){ - if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { + if ( urlArray[ i ].search( "data:video/mp4" ) === 0 || urlArray[ i ].search( ".mp4$" ) > -1 ) { mediaObject.m4v = urlArray[ i ]; - }else if( url.search( ".webm$" ) > -1 ){ + }else if( urlArray[ i ].search( ".webm$" ) > -1 ){ mediaObject.webmv = urlArray[ i ]; } else { modelDriver.logger.errorx( "setUrl", @@ -479,6 +479,9 @@ define( [ break; } + console.log("Setting media object!"); + console.log("Media object is: " + mediaObject) + // If we succeeded in creating a media object, set it on the jPlayer object // Otherwise, clear the current media if ( mediaObject ) { From 19b4ada6b72e9a1f58477ec009502d02ff88b246 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Mon, 2 Mar 2015 14:49:33 -0500 Subject: [PATCH 17/31] Adding some comments to explain what I commented out. --- support/client/lib/vwf/model/jPlayer.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 52a77a73b..8dbdb1236 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -12,8 +12,13 @@ define( [ var modelDriver; var jPlayerInstanceCreated = false; - var audioManagerProtoId = "http-vwf-example-com-jplayer-audioManager-vwf"; - var videoManagerProtoId = "http-vwf-example-com-jplayer-videoManager-vwf"; + // NXM: For some reason, using the format below breaks video! + // var audioManagerProtoId = "http-vwf-example-com-jplayer-audioManager-vwf"; + // var videoManagerProtoId = "http-vwf-example-com-jplayer-videoManager-vwf"; + + var audioManagerProtoId = "http://vwf.example.com/jplayer/audioManager.vwf"; + var videoManagerProtoId = "http://vwf.example.com/jplayer/videoManager.vwf"; + var jplayerContainerId = "jp_container_1"; return model.load( module, { @@ -129,8 +134,10 @@ define( [ if ( prototypeID.indexOf( audioManagerProtoId ) !== -1 ) { this.state.audioManagerProto = this.state.prototypes[ prototypeID ]; + this.logger.infox( "Got audio manager prototype!" ); } else if ( prototypeID.indexOf( videoManagerProtoId ) !== -1 ) { this.state.videoManagerProto = this.state.prototypes[ prototypeID ]; + this.logger.infox( "Got video manager prototype!" ); } return; @@ -361,6 +368,10 @@ define( [ var node = this.state.nodes[ nodeID ]; if ( !node ) { + //NATHAN: Remove the below... IF block... it's for debugging only + if( methodName === "play" ){ + this.logger.infox( "Node is NULL when calling: " + methodName + " on " + nodeID); + } return; } From e5f0d438d9feaef93d30dc03fda134b2bd54af1b Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Mon, 2 Mar 2015 14:54:10 -0500 Subject: [PATCH 18/31] Removed two unnecessary lines of code. --- support/client/lib/vwf/model/jPlayer.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 8dbdb1236..42841cd33 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -490,9 +490,6 @@ define( [ break; } - console.log("Setting media object!"); - console.log("Media object is: " + mediaObject) - // If we succeeded in creating a media object, set it on the jPlayer object // Otherwise, clear the current media if ( mediaObject ) { From 63f49b70b5e99f0a72b4191d91eb43029a0c94b9 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Mon, 2 Mar 2015 16:14:15 -0500 Subject: [PATCH 19/31] Cleaned up the video URL. Now we are ready to test if it's a string or a list. --- support/client/lib/vwf/model/jPlayer.js | 21 ++++++++++++------- .../jplayer/videoManager.vwf.yaml | 3 +-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 42841cd33..e97b9149d 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -459,6 +459,18 @@ define( [ // Construct the media object based on the type of file being passed in var mediaObject = {}; + + function setVideoURL( mediaObj, url ){ + if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { + mediaObj.m4v = url; + }else if( url.search( ".webm$" ) > -1 ){ + mediaObj.webmv = url; + } else { + modelDriver.logger.errorx( "setUrl", + "Unsupported video type for '", url, "'" ); + } + } + switch ( node.managerType ) { case "audio": //TODO: Support multiple URLs for audio. @@ -474,14 +486,7 @@ define( [ case "video": mediaObject.poster = node.posterImageUrl; for( var i = 0; i < urlArray.length; i++ ){ - if ( urlArray[ i ].search( "data:video/mp4" ) === 0 || urlArray[ i ].search( ".mp4$" ) > -1 ) { - mediaObject.m4v = urlArray[ i ]; - }else if( urlArray[ i ].search( ".webm$" ) > -1 ){ - mediaObject.webmv = urlArray[ i ]; - } else { - modelDriver.logger.errorx( "setUrl", - "Unsupported video type for '", url, "'" ); - } + setVideoURL( mediaObject, urlArray[i] ); } break; default: diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml index 2f6c0cc2c..124c640de 100644 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -2,12 +2,11 @@ extends: http://vwf.example.com/node.vwf properties: url: + altUrls: posterImageUrl: loop: false containerDivId: "jp_container_1" playerDivId: "videoScreen" - # containerDivId: "videoContainer" - # playerDivId: "videoScreen" containerSize: [ 1024, 768 ] playerSize: [ 1024, 768 ] methods: From e657c2b1b48367b14dbe58bf42fc8688a30ba227 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Mon, 2 Mar 2015 22:17:40 -0500 Subject: [PATCH 20/31] Added check to see if we're parsing a string or an array. --- support/client/lib/vwf/model/jPlayer.js | 65 ++++++++++--------------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index e97b9149d..879c3c8b4 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -243,22 +243,11 @@ define( [ var playerDiv = document.createElement( 'div' ); playerDiv.id = node.playerDivId; if( node.containerDivId ){ - // playerDiv.className = "jp-jplayer"; $( "#" + node.containerDivId ).append( playerDiv ); } else { $("#jp_container_1").append( playerDiv ); } node.jPlayerElement = $( "#" + node.playerDivId ); - - // $( "#" + jplayerContainerId ).jPlayer("option", "cssSelectorAncestor", "#" + node.playerDivId); - // $( "#" + jplayerContainerId ).attr( "id", node.playerDivId ); - // jplayerContainerId = node.playerDivId; - - // node.jPlayerElement = $( "#" + node.playerDivId ); - // node.jPlayerElement = $( "
", { - // id: node.playerDivId - // } ); - // $( "body" ).append( node.jPlayerElement ); } var fileTypes = ( node.managerType === "audio" ) ? "mp3,wav" : "m4v,webmv"; node.jPlayerElement.jPlayer( { @@ -274,11 +263,10 @@ define( [ } }, supplied: fileTypes, - // size: { width: node.playmoderDivSize[0], height: node.playerDivSize[1] } } ); if ( node.playerDivId ) { - $( "#" + node.playerDivId ).bind($.jPlayer.event.ended, this.state.videoEndedCallback ); + $( "#" + node.playerDivId ).bind( $.jPlayer.event.ended, this.state.videoEndedCallback ); } value = node.playerDivId; @@ -406,13 +394,6 @@ define( [ } ); - // function videoEndedCallback(){ - // var mediaManagerID = this.kernel.kernel.find( undefined, "/mediaManager" )[ 0 ]; - // var videoManagerID = this.kernel.kernel.find( mediaManagerID, "videoManager" ) [ 0 ]; - // console.log("Video ended callback in driver fired!"); - // this.kernel.fireEvent(videoManagerID, "videoEnded"); - // } - function getPrototypes( kernel, extendsID ) { var prototypes = []; var id = extendsID; @@ -443,7 +424,29 @@ define( [ } } - function setUrl( node, urlArray ) { + function setVideoURL( mediaObj, url ) { + if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { + mediaObj.m4v = url; + }else if( url.search( ".webm$" ) > -1 ){ + mediaObj.webmv = url; + } else { + modelDriver.logger.errorx( "setUrl", + "Unsupported video type for '", url, "'" ); + } + } + + function setUrl( node, url ) { + + var usingMultiUrls; + if( url.constructor === Array ){ + usingMultiUrls = true; + } else if( typeof url === 'string' ) { + usingMultiUrls = false; + } else { + modelDriver.logger.errorx( "setUrl", + "URL is not a string or an array" ); + } + var url = urlArray[ 0 ]; node.url = url; @@ -460,17 +463,6 @@ define( [ // Construct the media object based on the type of file being passed in var mediaObject = {}; - function setVideoURL( mediaObj, url ){ - if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { - mediaObj.m4v = url; - }else if( url.search( ".webm$" ) > -1 ){ - mediaObj.webmv = url; - } else { - modelDriver.logger.errorx( "setUrl", - "Unsupported video type for '", url, "'" ); - } - } - switch ( node.managerType ) { case "audio": //TODO: Support multiple URLs for audio. @@ -485,9 +477,9 @@ define( [ break; case "video": mediaObject.poster = node.posterImageUrl; - for( var i = 0; i < urlArray.length; i++ ){ - setVideoURL( mediaObject, urlArray[i] ); - } + // for( var i = 0; i < urlArray.length; i++ ){ + setVideoURL( mediaObject, urlArray[i] ); + // } break; default: modelDriver.logger.errorx( "setUrl", @@ -516,9 +508,6 @@ define( [ function setControlDivId( node, containerDivId ) { node.containerDivId = containerDivId; - // if ( node.jPlayerElement ) { - // node.jPlayerElement.jPlayer( "option", { cssSelectorAncestor: "#" + containerDivId } ); - // } } function setPosterImageUrl( node, posterImageUrl ) { From 6610428fa05c450406e6bcfd6d1efeef1badee48 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Tue, 3 Mar 2015 10:31:40 -0500 Subject: [PATCH 21/31] Cleand up the code a little bit - in setURL, we now determine if we're feeding it an array or a single string. --- support/client/lib/vwf/model/jPlayer.js | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 879c3c8b4..da9b16abc 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -134,10 +134,8 @@ define( [ if ( prototypeID.indexOf( audioManagerProtoId ) !== -1 ) { this.state.audioManagerProto = this.state.prototypes[ prototypeID ]; - this.logger.infox( "Got audio manager prototype!" ); } else if ( prototypeID.indexOf( videoManagerProtoId ) !== -1 ) { this.state.videoManagerProto = this.state.prototypes[ prototypeID ]; - this.logger.infox( "Got video manager prototype!" ); } return; @@ -435,19 +433,17 @@ define( [ } } - function setUrl( node, url ) { + function setUrl( node, inputUrl ) { var usingMultiUrls; - if( url.constructor === Array ){ + var url; + if( inputUrl && ( inputUrl.constructor === Array ) ){ usingMultiUrls = true; - } else if( typeof url === 'string' ) { + url = inputUrl[ 0 ]; + } else{ usingMultiUrls = false; - } else { - modelDriver.logger.errorx( "setUrl", - "URL is not a string or an array" ); - } - - var url = urlArray[ 0 ]; + url = inputUrl; + } node.url = url; // If there is no jPlayerElement, there is nothing to do yet so we return. @@ -477,9 +473,13 @@ define( [ break; case "video": mediaObject.poster = node.posterImageUrl; - // for( var i = 0; i < urlArray.length; i++ ){ - setVideoURL( mediaObject, urlArray[i] ); - // } + if( usingMultiUrls ) { + for( var i = 0; i < inputUrl.length; i++ ) { + setVideoURL( mediaObject, inputUrl[ i ] ); + } + } else { + setVideoURL( mediaObject, url ); + } break; default: modelDriver.logger.errorx( "setUrl", From f17cf61cd9bc17a8b52bcacdf77db4cce8130fae Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Wed, 4 Mar 2015 10:52:13 -0500 Subject: [PATCH 22/31] Fixed spacing and removed some debug code. --- support/client/lib/vwf/model/jPlayer.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index da9b16abc..37dc6ae75 100644 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -354,10 +354,6 @@ define( [ var node = this.state.nodes[ nodeID ]; if ( !node ) { - //NATHAN: Remove the below... IF block... it's for debugging only - if( methodName === "play" ){ - this.logger.infox( "Node is NULL when calling: " + methodName + " on " + nodeID); - } return; } @@ -425,7 +421,7 @@ define( [ function setVideoURL( mediaObj, url ) { if ( url.search( "data:video/mp4" ) === 0 || url.search( ".mp4$" ) > -1 ) { mediaObj.m4v = url; - }else if( url.search( ".webm$" ) > -1 ){ + } else if( url.search( ".webm$" ) > -1 ){ mediaObj.webmv = url; } else { modelDriver.logger.errorx( "setUrl", @@ -440,7 +436,7 @@ define( [ if( inputUrl && ( inputUrl.constructor === Array ) ){ usingMultiUrls = true; url = inputUrl[ 0 ]; - } else{ + } else { usingMultiUrls = false; url = inputUrl; } From b28b108a81356df8e625bf5bcc334e7a93811ee7 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Mon, 20 Apr 2015 17:21:29 -0400 Subject: [PATCH 23/31] Now we are checking if the URL exists. --- support/client/lib/vwf/model/jPlayer.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) mode change 100644 => 100755 support/client/lib/vwf/model/jPlayer.js diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js old mode 100644 new mode 100755 index 37dc6ae75..ebbe4dfde --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -220,6 +220,7 @@ define( [ setUrl( node, propertyValue ); value = node.url; break; + case "loop": setLoop( node, propertyValue ); value = node.loop; @@ -362,11 +363,17 @@ define( [ switch( methodName ) { case "play": - - if( methodParameters ){ - this.kernel.setProperty( node.ID, "url", methodParameters ); + //TODO: Check if URL exists. If it doesn't, print out an error. + //ALSO, node.url should be instantiated to null. Or something. + //Basically, if the URL is never set, we have to catch that. + //if( methodParameters ){ + //this.kernel.setProperty( node.ID, "url", methodParameters ); + //} + if( node.url ) { + node.jPlayerElement.jPlayer( "play" ); + } else { + } - node.jPlayerElement.jPlayer( "play" ); break; case "pause": From 0fb486e27d7b0515fb911cdf4416fc4e8a7fbf8c Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Mon, 20 Apr 2015 18:21:51 -0400 Subject: [PATCH 24/31] Separated setting the URL from playing the video. This should allow us to preload. --- support/client/lib/vwf/model/jPlayer.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index ebbe4dfde..874b91f07 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -363,16 +363,10 @@ define( [ switch( methodName ) { case "play": - //TODO: Check if URL exists. If it doesn't, print out an error. - //ALSO, node.url should be instantiated to null. Or something. - //Basically, if the URL is never set, we have to catch that. - //if( methodParameters ){ - //this.kernel.setProperty( node.ID, "url", methodParameters ); - //} if( node.url ) { node.jPlayerElement.jPlayer( "play" ); } else { - + this.logger.errorx( "No URL given!" ); } break; From 324e8776328743237dbf60bd61b4f71e8a80f0f9 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Tue, 21 Apr 2015 09:26:58 -0400 Subject: [PATCH 25/31] "load" now works in the jPlayer model. --- support/client/lib/vwf/model/jPlayer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 874b91f07..87a55cde8 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -362,6 +362,10 @@ define( [ switch( methodName ) { + case "load": + node.jPlayerElement.jPlayer( "load" ); + break; + case "play": if( node.url ) { node.jPlayerElement.jPlayer( "play" ); From 567290a80245e5aae02505d30e6073d88bfc0f24 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Tue, 21 Apr 2015 12:37:13 -0400 Subject: [PATCH 26/31] Got the load functionality into the jPlayer driver... --- support/client/lib/vwf/model/jPlayer.js | 7 ++++++- .../proxy/vwf.example.com/jplayer/videoManager.vwf.yaml | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) mode change 100644 => 100755 support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 87a55cde8..31a9fb7fe 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -363,7 +363,12 @@ define( [ switch( methodName ) { case "load": - node.jPlayerElement.jPlayer( "load" ); + if( node.url ) { + node.jPlayerElement.jPlayer( "load" ); + this.logger.infox( "Loading!" ); + } else { + this.logger.errorx( "No URL given!" ); + } break; case "play": diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml old mode 100644 new mode 100755 index 124c640de..751c6fb03 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -10,6 +10,7 @@ properties: containerSize: [ 1024, 768 ] playerSize: [ 1024, 768 ] methods: + load: play: pause: stop: @@ -17,4 +18,4 @@ methods: hide: clearMedia: events: - videoEnded: \ No newline at end of file + videoEnded: From 8815fcf94ec7838ffb939dca435a2fac5f86e4c9 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Wed, 22 Apr 2015 16:49:17 -0400 Subject: [PATCH 27/31] Now we can pre-load the correct cutscenes in the scenario1* series of scenarios. --- support/client/lib/vwf/model/jPlayer.js | 66 ++++++++++++++++--- .../jplayer/videoManager.vwf.yaml | 2 +- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 31a9fb7fe..721d0b3ac 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -221,6 +221,11 @@ define( [ value = node.url; break; + case "preload": + setPreload( node, propertyValue ); + value = node.preload; + break; + case "loop": setLoop( node, propertyValue ); value = node.loop; @@ -257,6 +262,9 @@ define( [ if ( node.loop !== undefined ) { setLoop( node, node.loop ); } + if ( node.preload !== undefined ) { + setPreload( node, node.preload ); + } if ( node.containerDivId !== undefined ) { setControlDivId( node, node.containerDivId ); } @@ -362,14 +370,19 @@ define( [ switch( methodName ) { - case "load": - if( node.url ) { - node.jPlayerElement.jPlayer( "load" ); - this.logger.infox( "Loading!" ); - } else { - this.logger.errorx( "No URL given!" ); - } - break; + //case "load": + //if( node.url ) { + //if( !node.loadedUrl || node.url !== node.loadedUrl ){ + //node.jPlayerElement.jPlayer( "load" ); + //node.loadedUrl = node.url; + //console.log("Loading!"); + //} else { + //console.log("Not loading, becuase node.url matches node.loadedURL"); + //} + //} else { + //this.logger.errorx( "No URL given!" ); + //} + //break; case "play": if( node.url ) { @@ -439,6 +452,30 @@ define( [ } } + Array.prototype.equals = function (array) { + // if the other array is a falsy value, return + if (!array) + return false; + + // compare lengths - can save a lot of time + if (this.length != array.length) + return false; + + for (var i = 0, l=this.length; i < l; i++) { + // Check if we have nested arrays + if (this[i] instanceof Array && array[i] instanceof Array) { + // recurse into the nested arrays + if (!this[i].equals(array[i])) + return false; + } + else if (this[i] != array[i]) { + // Warning - two different object instances will never be equal: {x:20} != {x:20} + return false; + } + } + return true; + } + function setUrl( node, inputUrl ) { var usingMultiUrls; @@ -450,6 +487,10 @@ define( [ usingMultiUrls = false; url = inputUrl; } + if( node.url && url && (node.url).equals( url ) ){ + console.log("Setting redudant URL! Quitting!"); + return; + } node.url = url; // If there is no jPlayerElement, there is nothing to do yet so we return. @@ -497,6 +538,7 @@ define( [ // Otherwise, clear the current media if ( mediaObject ) { node.jPlayerElement.jPlayer( "setMedia", mediaObject ); + node.jPlayerElement.jPlayer( "load" ); } else { node.jPlayerElement.jPlayer( "clearMedia" ); } @@ -505,6 +547,14 @@ define( [ } } + function setPreload( node, preload ) { + node.preload = preload; + if ( node.jPlayerElement ) { + node.jPlayerElement.jPlayer( "option", { preload: preload } ); + console.log("Setting preload to: " + preload); + } + } + function setLoop( node, loop ) { node.loop = loop; if ( node.jPlayerElement ) { diff --git a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml index 751c6fb03..bf0930b36 100755 --- a/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml +++ b/support/proxy/vwf.example.com/jplayer/videoManager.vwf.yaml @@ -9,8 +9,8 @@ properties: playerDivId: "videoScreen" containerSize: [ 1024, 768 ] playerSize: [ 1024, 768 ] + preload: "auto" methods: - load: play: pause: stop: From dae264d5b1fdb3f4d5ced959a99fd903e92f4e40 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Wed, 22 Apr 2015 19:01:31 -0400 Subject: [PATCH 28/31] Now the jPlayer driver doesn't set the URL (which may cause a load to trigger) if its being set to the same URL as before. --- support/client/lib/vwf/model/jPlayer.js | 52 +++++++++++++------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 721d0b3ac..1a1cf91ab 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -452,29 +452,31 @@ define( [ } } - Array.prototype.equals = function (array) { - // if the other array is a falsy value, return - if (!array) - return false; - - // compare lengths - can save a lot of time - if (this.length != array.length) - return false; - - for (var i = 0, l=this.length; i < l; i++) { - // Check if we have nested arrays - if (this[i] instanceof Array && array[i] instanceof Array) { - // recurse into the nested arrays - if (!this[i].equals(array[i])) - return false; - } - else if (this[i] != array[i]) { - // Warning - two different object instances will never be equal: {x:20} != {x:20} - return false; - } - } - return true; - } +/* + * Array.prototype.equals = function (array) { + * // if the other array is a falsy value, return + * if (!array) + * return false; + * + * // compare lengths - can save a lot of time + * if (this.length != array.length) + * return false; + * + * for (var i = 0, l=this.length; i < l; i++) { + * // Check if we have nested arrays + * if (this[i] instanceof Array && array[i] instanceof Array) { + * // recurse into the nested arrays + * if (!this[i].equals(array[i])) + * return false; + * } + * else if (this[i] != array[i]) { + * // Warning - two different object instances will never be equal: {x:20} != {x:20} + * return false; + * } + * } + * return true; + * } + */ function setUrl( node, inputUrl ) { @@ -487,10 +489,12 @@ define( [ usingMultiUrls = false; url = inputUrl; } - if( node.url && url && (node.url).equals( url ) ){ + + if( node.url && url && ( node.url === url ) ){ console.log("Setting redudant URL! Quitting!"); return; } + node.url = url; // If there is no jPlayerElement, there is nothing to do yet so we return. From aefead2293c5b1b17d307313af3027988cfb8d9e Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Thu, 23 Apr 2015 12:39:08 -0400 Subject: [PATCH 29/31] Update jPlayer.js Got rid of unnecessary, commented-out code. --- support/client/lib/vwf/model/jPlayer.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index 1a1cf91ab..fa1573a0a 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -370,20 +370,6 @@ define( [ switch( methodName ) { - //case "load": - //if( node.url ) { - //if( !node.loadedUrl || node.url !== node.loadedUrl ){ - //node.jPlayerElement.jPlayer( "load" ); - //node.loadedUrl = node.url; - //console.log("Loading!"); - //} else { - //console.log("Not loading, becuase node.url matches node.loadedURL"); - //} - //} else { - //this.logger.errorx( "No URL given!" ); - //} - //break; - case "play": if( node.url ) { node.jPlayerElement.jPlayer( "play" ); From f31f6a3efe8504022dddad4cfabaff8ecbb48d02 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Thu, 23 Apr 2015 12:39:39 -0400 Subject: [PATCH 30/31] Update jPlayer.js Got rid of another commented-out block that has no relevance. --- support/client/lib/vwf/model/jPlayer.js | 26 ------------------------- 1 file changed, 26 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index fa1573a0a..f0cf70674 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -438,32 +438,6 @@ define( [ } } -/* - * Array.prototype.equals = function (array) { - * // if the other array is a falsy value, return - * if (!array) - * return false; - * - * // compare lengths - can save a lot of time - * if (this.length != array.length) - * return false; - * - * for (var i = 0, l=this.length; i < l; i++) { - * // Check if we have nested arrays - * if (this[i] instanceof Array && array[i] instanceof Array) { - * // recurse into the nested arrays - * if (!this[i].equals(array[i])) - * return false; - * } - * else if (this[i] != array[i]) { - * // Warning - two different object instances will never be equal: {x:20} != {x:20} - * return false; - * } - * } - * return true; - * } - */ - function setUrl( node, inputUrl ) { var usingMultiUrls; From cbf764c83f4725b9df2922e312aa074541bb5923 Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Tue, 15 Dec 2015 17:18:33 -0500 Subject: [PATCH 31/31] kernel prototypes change --- support/client/lib/vwf/model/jPlayer.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/support/client/lib/vwf/model/jPlayer.js b/support/client/lib/vwf/model/jPlayer.js index f0cf70674..95eeb8ed5 100755 --- a/support/client/lib/vwf/model/jPlayer.js +++ b/support/client/lib/vwf/model/jPlayer.js @@ -141,7 +141,7 @@ define( [ return; } - var protos = getPrototypes( this.kernel, childExtendsID ); + var protos = this.kernel.prototypes( childID ); var isAudioManager = this.state.isAudioManager( protos ); var isVideoManager = this.state.isVideoManager( protos ); @@ -397,18 +397,6 @@ define( [ } ); - function getPrototypes( kernel, extendsID ) { - var prototypes = []; - var id = extendsID; - - while ( id !== undefined ) { - prototypes.push( id ); - id = kernel.prototype( id ); - } - - return prototypes; - } - function setWithPrototypeProperties( proto ) { if ( proto.url !== null ) { vwf.setProperty( node.ID, "url", proto.url );