Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed video load bug in multiple perspectives where some browsers str…
…uggle to load all thumbnails - default thumbnail for videos is now an image. You can override this with an image you upload (optional property) or use the first frame of video.

Header text added to mediaPlayer.js.
  • Loading branch information
FayCross committed Dec 10, 2014
1 parent 36977ff commit 95c0899
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 65 deletions.
@@ -1,3 +1,22 @@
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

(function($){

$.fn.mediaPlayer = function(options) {
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
265 changes: 211 additions & 54 deletions modules/xerte/parent_templates/Nottingham/data.xwd

Large diffs are not rendered by default.

Expand Up @@ -144,17 +144,37 @@
perspectives.loadImage($thisThumb.find("img"), [$thisThumb.width(), $thisThumb.height() - $thisThumb.find("h3").height() - 5], imgSrc);

} else if (this.nodeName == "movie") {
$thisThumbMedia.html('<div class="thumbVideo" title="' + videoTip + '"></div>');

var $thisVideo = $thisThumbMedia.find("div");
$thisVideo
.data({
"src" :this.getAttribute("src"),
"dimensions":[$thisThumb.width(), $thisThumb.height() - $thisThumb.find("h3").height() - 5]
})
.attr("disabled", "disabled");
if (this.getAttribute("tooltip") != undefined) {
imgTip = this.getAttribute("tooltip");
} else {
imgTip = videoTip;
}

perspectives.loadVideo($thisVideo);
// defaults to use video.jpg as thumbnail
// unless an img is uploaded
// or the useVidThumb optional property is set so 1st frame in video shows (not default any more as often takes too long for them all to load)
if (this.getAttribute("useVidThumb") == "true") {
$thisThumbMedia.html('<div class="thumbVideo" title="' + imgTip + '"></div>');

var $thisVideo = $thisThumbMedia.find("div");
$thisVideo
.data({
"src" :this.getAttribute("src"),
"dimensions":[$thisThumb.width(), $thisThumb.height() - $thisThumb.find("h3").height() - 5]
})
.attr("disabled", "disabled");

perspectives.loadVideo($thisVideo);

} else {
imgSrc = x_templateLocation + "common_html5/video.jpg";
if (this.getAttribute("img") != undefined && this.getAttribute("img") != "") {
imgSrc = eval(this.getAttribute("img"));
}

$thisThumbMedia.html('<img alt="' + imgTip + '" class="centre" />');
perspectives.loadImage($thisThumb.find("img"), [$thisThumb.width(), $thisThumb.height() - $thisThumb.find("h3").height() - 5], imgSrc);
}
}
}
});
Expand Down
Expand Up @@ -1298,6 +1298,9 @@
<txt label="Text" type="TextArea" height="300"/>
<src label="Video File" type="media"/>
<movieSize label="Video Size" type="textInput" defaultValue="320,240" optional="true"/>
<img label="Image" type="media" optional="true"/>
<tooltip label="Tooltip" type="TextInput" optional="true"/>
<useVidThumb label="1st Frame as Thumbnail" type="Checkbox" optional="true"/>
</movie><sound menuItem="Sound" icon="icSound" duplicate="true" remove="true">
<name label="Title" type="TextInput"/>
<txt label="Text" type="TextArea" height="300"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Nottingham/wizards/en-GB/perspectives.xwd
@@ -1 +1 @@
<wizard menus="Media"> <pageWizard remove="true" duplicate="false"> <newNodes> <perspectives><![CDATA[<perspectives name="Enter Page Title" backBtnTip="Back" nextBtnTip="Forward" videoTip="Video Clip" soundTip="Sound Clip"/>]]></perspectives> </newNodes> </pageWizard> <!-- MULTIPLE PERSPECTIVES PAGE===================================== --> <perspectives menu="Media" menuItem="Multiple Perspectives" hint="A page for multiple video and sound clips to be viewed and compared." icon="icUser" thumb="thumbs/perspectives.jpg" remove="true"> <name label="Page Title" type="TextInput" /> <backBtnTip label="Back Button Tip" type="TextInput" language="true" /> <nextBtnTip label="Next Button Tip" type="TextInput" language="true" /> <videoTip label="Generic Video Tip" type="TextInput" language="true" /> <soundTip label="Generic Sound Tip" type="TextInput" language="true" /> <narrationNavigate label="Navigate on narration" type="CheckBox" defaultValue="false" optional="true"/> <playNarration label="Auto-play narration" type="CheckBox" defaultValue="false" optional="true"/> <narration label="Narration" type="media" optional="true"/> <navSetting label="Navigation Buttons" options="All,Back and Next,Back Only,Next Only,None" type="ComboBox" width="120" data="all,backnext,backonly,nextonly,none" defaultValue="all" optional="true"/> <pageID label="Page ID" defaultValue="Unique ID for this page" type="TextInput" optional="true" /> <newNodes> <movie><![CDATA[<movie txt="Enter text for the page here" src="Select a Video" name="Video"></movie>]]></movie> <sound><![CDATA[<sound txt="Enter text for the page here" src="Select a Sound" name="Sound"></sound>]]></sound> <image><![CDATA[<image txt="Enter text for the page here" src="Select an Image" name="Image" tooltip="Enter a Tooltip"></image>]]></image> </newNodes> </perspectives> <movie menuItem="Video" icon="icPageWhiteFilm" duplicate="true" remove="true"> <name label="Title" type="TextInput" /> <txt label="Text" type="TextArea" height="300" /> <src label="Video File" type="media" /> <movieSize label="Video Size" type="textInput" defaultValue="320,240" optional="true"/> </movie> <sound menuItem="Sound" icon="icSound" duplicate="true" remove="true"> <name label="Title" type="TextInput" /> <txt label="Text" type="TextArea" height="300" /> <src label="Sound File" type="media" /> <img label="Image" type="media" optional="true" /> <tooltip label="Image Tooltip" type="TextInput" optional="true"/> </sound> <image menuItem="Image" icon="icImage" duplicate="true" remove="true"> <name label="Title" type="TextInput"/> <txt label="Text" type="TextArea" height="300"/> <src label="Image File" type="media"/> <tooltip label="Image Tooltip" type="TextInput"/> </image> </wizard>
<wizard menus="Media"> <pageWizard remove="true" duplicate="false"> <newNodes> <perspectives><![CDATA[<perspectives name="Enter Page Title" backBtnTip="Back" nextBtnTip="Forward" videoTip="Video Clip" soundTip="Sound Clip"/>]]></perspectives> </newNodes> </pageWizard> <!-- MULTIPLE PERSPECTIVES PAGE===================================== --> <perspectives menu="Media" menuItem="Multiple Perspectives" hint="A page for multiple video and sound clips to be viewed and compared." icon="icUser" thumb="thumbs/perspectives.jpg" remove="true"> <name label="Page Title" type="TextInput" /> <backBtnTip label="Back Button Tip" type="TextInput" language="true" /> <nextBtnTip label="Next Button Tip" type="TextInput" language="true" /> <videoTip label="Generic Video Tip" type="TextInput" language="true" /> <soundTip label="Generic Sound Tip" type="TextInput" language="true" /> <narrationNavigate label="Navigate on narration" type="CheckBox" defaultValue="false" optional="true"/> <playNarration label="Auto-play narration" type="CheckBox" defaultValue="false" optional="true"/> <narration label="Narration" type="media" optional="true"/> <navSetting label="Navigation Buttons" options="All,Back and Next,Back Only,Next Only,None" type="ComboBox" width="120" data="all,backnext,backonly,nextonly,none" defaultValue="all" optional="true"/> <pageID label="Page ID" defaultValue="Unique ID for this page" type="TextInput" optional="true" /> <newNodes> <movie><![CDATA[<movie txt="Enter text for the page here" src="Select a Video" name="Video"></movie>]]></movie> <sound><![CDATA[<sound txt="Enter text for the page here" src="Select a Sound" name="Sound"></sound>]]></sound> <image><![CDATA[<image txt="Enter text for the page here" src="Select an Image" name="Image" tooltip="Enter a Tooltip"></image>]]></image> </newNodes> </perspectives> <movie menuItem="Video" icon="icPageWhiteFilm" duplicate="true" remove="true"> <name label="Title" type="TextInput" /> <txt label="Text" type="TextArea" height="300" /> <src label="Video File" type="media" /> <movieSize label="Video Size" type="textInput" defaultValue="320,240" optional="true"/> <img label="Image" type="media" optional="true"/> <tooltip label="Tooltip" type="TextInput" optional="true"/> <useVidThumb label="1st Frame as Thumbnail" type="Checkbox" optional="true"/> </movie> <sound menuItem="Sound" icon="icSound" duplicate="true" remove="true"> <name label="Title" type="TextInput" /> <txt label="Text" type="TextArea" height="300" /> <src label="Sound File" type="media" /> <img label="Image" type="media" optional="true" /> <tooltip label="Image Tooltip" type="TextInput" optional="true"/> </sound> <image menuItem="Image" icon="icImage" duplicate="true" remove="true"> <name label="Title" type="TextInput"/> <txt label="Text" type="TextArea" height="300"/> <src label="Image File" type="media"/> <tooltip label="Image Tooltip" type="TextInput"/> </image> </wizard>
Expand Down
3 changes: 3 additions & 0 deletions src/Nottingham/wizards/en-GB/template.xwd
Expand Up @@ -1298,6 +1298,9 @@
<txt label="Text" type="TextArea" height="300"/>
<src label="Video File" type="media"/>
<movieSize label="Video Size" type="textInput" defaultValue="320,240" optional="true"/>
<img label="Image" type="media" optional="true"/>
<tooltip label="Tooltip" type="TextInput" optional="true"/>
<useVidThumb label="1st Frame as Thumbnail" type="Checkbox" optional="true"/>
</movie><sound menuItem="Sound" icon="icSound" duplicate="true" remove="true">
<name label="Title" type="TextInput"/>
<txt label="Text" type="TextArea" height="300"/>
Expand Down

0 comments on commit 95c0899

Please sign in to comment.