Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
22b5decc
Commit
22b5decc
authored
Aug 20, 2013
by
Anton Stupak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes.
parent
63c5ec52
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
30 deletions
+31
-30
common/lib/xmodule/xmodule/js/spec/helper.coffee
+1
-0
common/lib/xmodule/xmodule/js/spec/video/general_spec.js
+6
-6
common/lib/xmodule/xmodule/js/src/video/01_initialize.js
+24
-24
No files found.
common/lib/xmodule/xmodule/js/spec/helper.coffee
View file @
22b5decc
...
@@ -91,6 +91,7 @@ jasmine.stubRequests = ->
...
@@ -91,6 +91,7 @@ jasmine.stubRequests = ->
spyOn
(
$
,
'ajax'
).
andCallFake
(
settings
)
->
spyOn
(
$
,
'ajax'
).
andCallFake
(
settings
)
->
if
match
=
settings
.
url
.
match
/youtube\.com\/.+\/videos\/(.+)\?v=2&alt=jsonc/
if
match
=
settings
.
url
.
match
/youtube\.com\/.+\/videos\/(.+)\?v=2&alt=jsonc/
if
settings
.
success
if
settings
.
success
# match[1] - it's video ID
settings
.
success
data
:
jasmine
.
stubbedMetadata
[
match
[
1
]]
settings
.
success
data
:
jasmine
.
stubbedMetadata
[
match
[
1
]]
else
{
else
{
always
:
(
callback
)
->
always
:
(
callback
)
->
...
...
common/lib/xmodule/xmodule/js/spec/video/general_spec.js
View file @
22b5decc
...
@@ -61,12 +61,12 @@
...
@@ -61,12 +61,12 @@
describe
(
'Check Youtube link existence'
,
function
()
{
describe
(
'Check Youtube link existence'
,
function
()
{
var
statusList
=
{
var
statusList
=
{
'error'
:
'html5'
,
error
:
'html5'
,
'timeout'
:
'html5'
,
timeout
:
'html5'
,
'abort'
:
'html5'
,
abort
:
'html5'
,
'parsererror'
:
'html5'
,
parsererror
:
'html5'
,
'success'
:
'youtube'
,
success
:
'youtube'
,
'notmodified'
:
'youtube'
notmodified
:
'youtube'
};
};
function
stubDeffered
(
data
,
status
)
{
function
stubDeffered
(
data
,
status
)
{
...
...
common/lib/xmodule/xmodule/js/src/video/01_initialize.js
View file @
22b5decc
...
@@ -201,44 +201,44 @@ function (VideoPlayer) {
...
@@ -201,44 +201,44 @@ function (VideoPlayer) {
// The function set initial configuration and preparation.
// The function set initial configuration and preparation.
function
initialize
(
element
)
{
function
initialize
(
element
)
{
var
state
=
this
;
var
_this
=
this
;
// This is used in places where we instead would have to check if an element has a CSS class 'fullscreen'.
// This is used in places where we instead would have to check if an element has a CSS class 'fullscreen'.
state
.
isFullScreen
=
false
;
this
.
isFullScreen
=
false
;
// The parent element of the video, and the ID.
// The parent element of the video, and the ID.
state
.
el
=
$
(
element
).
find
(
'.video'
);
this
.
el
=
$
(
element
).
find
(
'.video'
);
state
.
id
=
state
.
el
.
attr
(
'id'
).
replace
(
/video_/
,
''
);
this
.
id
=
this
.
el
.
attr
(
'id'
).
replace
(
/video_/
,
''
);
// We store all settings passed to us by the server in one place. These are "read only", so don't
// We store all settings passed to us by the server in one place. These are "read only", so don't
// modify them. All variable content lives in 'state' object.
// modify them. All variable content lives in 'state' object.
state
.
config
=
{
this
.
config
=
{
element
:
element
,
element
:
element
,
start
:
state
.
el
.
data
(
'start'
),
start
:
this
.
el
.
data
(
'start'
),
end
:
state
.
el
.
data
(
'end'
),
end
:
this
.
el
.
data
(
'end'
),
caption_data_dir
:
state
.
el
.
data
(
'caption-data-dir'
),
caption_data_dir
:
this
.
el
.
data
(
'caption-data-dir'
),
caption_asset_path
:
state
.
el
.
data
(
'caption-asset-path'
),
caption_asset_path
:
this
.
el
.
data
(
'caption-asset-path'
),
show_captions
:
(
state
.
el
.
data
(
'show-captions'
).
toString
().
toLowerCase
()
===
'true'
),
show_captions
:
(
this
.
el
.
data
(
'show-captions'
).
toString
().
toLowerCase
()
===
'true'
),
youtubeStreams
:
state
.
el
.
data
(
'streams'
),
youtubeStreams
:
this
.
el
.
data
(
'streams'
),
sub
:
state
.
el
.
data
(
'sub'
),
sub
:
this
.
el
.
data
(
'sub'
),
mp4Source
:
state
.
el
.
data
(
'mp4-source'
),
mp4Source
:
this
.
el
.
data
(
'mp4-source'
),
webmSource
:
state
.
el
.
data
(
'webm-source'
),
webmSource
:
this
.
el
.
data
(
'webm-source'
),
oggSource
:
state
.
el
.
data
(
'ogg-source'
),
oggSource
:
this
.
el
.
data
(
'ogg-source'
),
fadeOutTimeout
:
1400
,
fadeOutTimeout
:
1400
,
availableQualities
:
[
'hd720'
,
'hd1080'
,
'highres'
]
availableQualities
:
[
'hd720'
,
'hd1080'
,
'highres'
]
};
};
if
(
!
(
_parseYouTubeIDs
(
state
)))
{
if
(
!
(
_parseYouTubeIDs
(
this
)))
{
// If we do not have YouTube ID's, try parsing HTML5 video sources.
// If we do not have YouTube ID's, try parsing HTML5 video sources.
_prepareHTML5Video
(
state
);
_prepareHTML5Video
(
this
);
_setConfigurations
(
state
);
_setConfigurations
(
this
);
_renderElements
(
state
);
_renderElements
(
this
);
}
else
{
}
else
{
state
.
getVideoMetadata
()
this
.
getVideoMetadata
()
.
always
(
function
(
json
,
status
)
{
.
always
(
function
(
json
,
status
)
{
var
err
=
$
.
isPlainObject
(
json
.
error
)
||
var
err
=
$
.
isPlainObject
(
json
.
error
)
||
(
status
!==
"success"
&&
status
!==
"notmodified"
);
(
status
!==
"success"
&&
status
!==
"notmodified"
);
...
@@ -247,12 +247,12 @@ function (VideoPlayer) {
...
@@ -247,12 +247,12 @@ function (VideoPlayer) {
// When the youtube link doesn't work for any reason
// When the youtube link doesn't work for any reason
// (for example, the great firewall in china) any
// (for example, the great firewall in china) any
// alternate sources should automatically play.
// alternate sources should automatically play.
_prepareHTML5Video
(
state
);
_prepareHTML5Video
(
_this
);
state
.
el
.
find
(
'a.quality_control'
).
hide
();
_this
.
el
.
find
(
'a.quality_control'
).
hide
();
}
}
_setConfigurations
(
state
);
_setConfigurations
(
_this
);
_renderElements
(
state
);
_renderElements
(
_this
);
});
});
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment