Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions common/lib/xmodule/xmodule/css/video/display.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ div.video {
padding-bottom: 56.25%;
position: relative;

div {
&.hidden {
display: none;
}
}

object, iframe {
border: none;
height: 100%;
Expand All @@ -48,6 +54,15 @@ div.video {
top: 0;
width: 100%;
}

h3 {
text-align: center;
color: white;

&.hidden {
display: none;
}
}
}

section.video-controls {
Expand Down Expand Up @@ -516,6 +531,12 @@ div.video {
height: 0px;
}

article.video-wrapper section.video-player {
h3 {
color: black;
}
}

ol.subtitles {
width: 0;
height: 0;
Expand Down Expand Up @@ -563,6 +584,12 @@ div.video {
position: static;
}

article.video-wrapper section.video-player {
h3 {
color: white;
}
}

div.tc-wrapper {
@include clearfix;
display: table;
Expand Down
2 changes: 2 additions & 0 deletions common/lib/xmodule/xmodule/js/fixtures/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
data-end=""
data-caption-asset-path="/static/subs/"
data-autoplay="False"
data-yt-test-timeout="1500"
data-yt-test-url="https://gdata.youtube.com/feeds/api/videos/"
>
<div class="tc-wrapper">
<article class="video-wrapper">
Expand Down
4 changes: 3 additions & 1 deletion common/lib/xmodule/xmodule/js/fixtures/video_all.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
data-webm-source="test_files/test.webm"
data-ogg-source="test_files/test.ogv"
data-autoplay="False"
data-yt-test-timeout="1500"
data-yt-test-url="https://gdata.youtube.com/feeds/api/videos/"
>
<div class="tc-wrapper">
<article class="video-wrapper">
Expand Down Expand Up @@ -55,4 +57,4 @@ <h3>Speed</h3>
</div>
</div>
</div>
</div>
</div>
4 changes: 3 additions & 1 deletion common/lib/xmodule/xmodule/js/fixtures/video_html5.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
data-webm-source="test_files/test.webm"
data-ogg-source="test_files/test.ogv"
data-autoplay="False"
data-yt-test-timeout="1500"
data-yt-test-url="https://gdata.youtube.com/feeds/api/videos/"
>
<div class="tc-wrapper">
<article class="video-wrapper">
Expand All @@ -27,4 +29,4 @@
</div>
</div>
</div>
</div>
</div>
2 changes: 2 additions & 0 deletions common/lib/xmodule/xmodule/js/fixtures/video_no_captions.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
data-end=""
data-caption-asset-path="/static/subs/"
data-autoplay="False"
data-yt-test-timeout="1500"
data-yt-test-url="https://gdata.youtube.com/feeds/api/videos/"
>
<div class="tc-wrapper">
<article class="video-wrapper">
Expand Down
16 changes: 14 additions & 2 deletions common/lib/xmodule/xmodule/js/spec/helper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,24 @@ jasmine.stubbedHtml5Speeds = ['0.75', '1.0', '1.25', '1.50']
jasmine.stubRequests = ->
spyOn($, 'ajax').andCallFake (settings) ->
if match = settings.url.match /youtube\.com\/.+\/videos\/(.+)\?v=2&alt=jsonc/
if settings.success
status = match[1].split('_')
if status and status[0] is 'status'
{
always: (callback) ->
callback.call(window, {}, status[1])
error: (callback) ->
callback.call(window, {}, status[1])
done: (callback) ->
callback.call(window, {}, status[1])
}
else if settings.success
# match[1] - it's video ID
settings.success data: jasmine.stubbedMetadata[match[1]]
else {
always: (callback) ->
callback.call(window, {}, 'success');
callback.call(window, {}, 'success')
done: (callback) ->
callback.call(window, {}, 'success')
}
else if match = settings.url.match /static(\/.*)?\/subs\/(.+)\.srt\.sjson/
settings.success jasmine.stubbedCaption
Expand Down
60 changes: 16 additions & 44 deletions common/lib/xmodule/xmodule/js/spec/video/general_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,46 +55,6 @@
expect(this.state.speed).toEqual('0.75');
});
});

describe('Check Youtube link existence', function () {
var statusList = {
error: 'html5',
timeout: 'html5',
abort: 'html5',
parsererror: 'html5',
success: 'youtube',
notmodified: 'youtube'
};

function stubDeffered(data, status) {
return {
always: function(callback) {
callback.call(window, data, status);
}
}
}

function checkPlayer(videoType, data, status) {
this.state = new window.Video('#example');
spyOn(this.state , 'getVideoMetadata')
.andReturn(stubDeffered(data, status));
this.state.initialize('#example');

expect(this.state.videoType).toEqual(videoType);
}

it('if video id is incorrect', function () {
checkPlayer('html5', { error: {} }, 'success');
});

$.each(statusList, function(status, mode){
it('Status:' + status + ', mode:' + mode, function () {
checkPlayer(mode, {}, status);
});
});

});

});

describe('HTML5', function () {
Expand Down Expand Up @@ -154,10 +114,22 @@

it('parse Html5 sources', function () {
var html5Sources = {
mp4: 'test_files/test.mp4',
webm: 'test_files/test.webm',
ogg: 'test_files/test.ogv'
};
mp4: null,
webm: null,
ogg: null
}, v = document.createElement('video');

if (!!(v.canPlayType && v.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''))) {
html5Sources['webm'] = 'xmodule/include/fixtures/test.webm';
}

if (!!(v.canPlayType && v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''))) {
html5Sources['mp4'] = 'xmodule/include/fixtures/test.mp4';
}

if (!!(v.canPlayType && v.canPlayType('video/ogg; codecs="theora"').replace(/no/, ''))) {
html5Sources['ogg'] = 'xmodule/include/fixtures/test.ogv';
}

expect(state.html5Sources).toEqual(html5Sources);
});
Expand Down
Loading