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
e3f499a7
Commit
e3f499a7
authored
Sep 09, 2014
by
zubair-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show video controls for all youtube videos
TNL-184
parent
541419e3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
6 deletions
+68
-6
common/djangoapps/terrain/stubs/youtube.py
+28
-1
common/lib/xmodule/xmodule/js/src/video/01_initialize.js
+1
-1
common/test/acceptance/pages/studio/video/video.py
+13
-1
common/test/acceptance/tests/video/test_studio_video_module.py
+26
-3
No files found.
common/djangoapps/terrain/stubs/youtube.py
View file @
e3f499a7
...
@@ -90,7 +90,10 @@ class StubYouTubeHandler(StubHttpRequestHandler):
...
@@ -90,7 +90,10 @@ class StubYouTubeHandler(StubHttpRequestHandler):
params
=
urlparse
(
self
.
path
)
params
=
urlparse
(
self
.
path
)
youtube_id
=
params
.
path
.
split
(
'/'
)
.
pop
()
youtube_id
=
params
.
path
.
split
(
'/'
)
.
pop
()
self
.
_send_video_response
(
youtube_id
,
"I'm youtube."
)
if
self
.
server
.
config
.
get
(
'youtube_api_private_video'
):
self
.
_send_private_video_response
(
youtube_id
,
"I'm youtube private video."
)
else
:
self
.
_send_video_response
(
youtube_id
,
"I'm youtube."
)
elif
'get_youtube_api'
in
self
.
path
:
elif
'get_youtube_api'
in
self
.
path
:
if
self
.
server
.
config
.
get
(
'youtube_api_blocked'
):
if
self
.
server
.
config
.
get
(
'youtube_api_blocked'
):
...
@@ -130,6 +133,30 @@ class StubYouTubeHandler(StubHttpRequestHandler):
...
@@ -130,6 +133,30 @@ class StubYouTubeHandler(StubHttpRequestHandler):
self
.
send_response
(
200
,
content
=
response
,
headers
=
{
'Content-type'
:
'text/html'
})
self
.
send_response
(
200
,
content
=
response
,
headers
=
{
'Content-type'
:
'text/html'
})
self
.
log_message
(
"Youtube: sent response {}"
.
format
(
message
))
self
.
log_message
(
"Youtube: sent response {}"
.
format
(
message
))
def
_send_private_video_response
(
self
,
message
):
"""
Send private video error message back to the client for video player requests.
"""
# Construct the response content
callback
=
self
.
get_params
[
'callback'
]
data
=
OrderedDict
({
"error"
:
OrderedDict
({
"code"
:
403
,
"errors"
:
[
{
"code"
:
"ServiceForbiddenException"
,
"domain"
:
"GData"
,
"internalReason"
:
"Private video"
}
],
"message"
:
message
,
})
})
response
=
"{cb}({data})"
.
format
(
cb
=
callback
,
data
=
json
.
dumps
(
data
))
self
.
send_response
(
200
,
content
=
response
,
headers
=
{
'Content-type'
:
'text/html'
})
self
.
log_message
(
"Youtube: sent response {}"
.
format
(
message
))
class
StubYouTubeService
(
StubHttpService
):
class
StubYouTubeService
(
StubHttpService
):
"""
"""
...
...
common/lib/xmodule/xmodule/js/src/video/01_initialize.js
View file @
e3f499a7
...
@@ -756,7 +756,7 @@ function (VideoPlayer, VideoStorage, i18n) {
...
@@ -756,7 +756,7 @@ function (VideoPlayer, VideoStorage, i18n) {
try
{
try
{
return
this
.
metadata
[
this
.
youtubeId
()].
duration
;
return
this
.
metadata
[
this
.
youtubeId
()].
duration
;
}
catch
(
err
)
{
}
catch
(
err
)
{
return
this
.
metadata
[
this
.
youtubeId
(
'1.0'
)].
duration
;
return
_
.
result
(
this
.
metadata
[
this
.
youtubeId
(
'1.0'
)],
'duration'
)
||
0
;
}
}
}
}
...
...
common/test/acceptance/pages/studio/video/video.py
View file @
e3f499a7
...
@@ -118,7 +118,19 @@ class VideoComponentPage(VideoPage):
...
@@ -118,7 +118,19 @@ class VideoComponentPage(VideoPage):
self
.
_wait_for
(
lambda
:
self
.
q
(
css
=
CLASS_SELECTORS
[
'video_init'
])
.
present
,
'Video Player Initialized'
)
self
.
_wait_for
(
lambda
:
self
.
q
(
css
=
CLASS_SELECTORS
[
'video_init'
])
.
present
,
'Video Player Initialized'
)
self
.
_wait_for
(
lambda
:
not
self
.
q
(
css
=
CLASS_SELECTORS
[
'video_spinner'
])
.
visible
,
self
.
_wait_for
(
lambda
:
not
self
.
q
(
css
=
CLASS_SELECTORS
[
'video_spinner'
])
.
visible
,
'Video Buffering Completed'
)
'Video Buffering Completed'
)
self
.
_wait_for
(
lambda
:
self
.
q
(
css
=
CLASS_SELECTORS
[
'video_controls'
])
.
visible
,
'Player Controls are Visible'
)
self
.
_wait_for
(
self
.
is_controls_visible
,
'Player Controls are Visible'
)
@wait_for_js
def
is_controls_visible
(
self
):
"""
Get current visibility sate of all video controls.
Returns:
bool: True means video controls are visible for all videos, False means video controls are not visible
for one or more videos
"""
return
self
.
q
(
css
=
CLASS_SELECTORS
[
'video_controls'
])
.
visible
def
click_button
(
self
,
button_name
,
index
=
0
):
def
click_button
(
self
,
button_name
,
index
=
0
):
"""
"""
...
...
common/test/acceptance/tests/video/test_studio_video_module.py
View file @
e3f499a7
...
@@ -95,12 +95,14 @@ class CMSVideoBaseTest(UniqueCourseTest):
...
@@ -95,12 +95,14 @@ class CMSVideoBaseTest(UniqueCourseTest):
self
.
_install_course_fixture
()
self
.
_install_course_fixture
()
self
.
_navigate_to_course_unit_page
()
self
.
_navigate_to_course_unit_page
()
def
edit_component
(
self
):
def
edit_component
(
self
,
xblock_index
=
1
):
"""
"""
Open component Edit Dialog for first component on page.
Open component Edit Dialog for first component on page.
Arguments:
xblock_index: number starting from 1 (0th entry is the unit page itself)
"""
"""
# The 0th entry is the unit page itself.
self
.
unit_page
.
xblocks
[
xblock_index
]
.
edit
()
self
.
unit_page
.
xblocks
[
1
]
.
edit
()
def
open_advanced_tab
(
self
):
def
open_advanced_tab
(
self
):
"""
"""
...
@@ -225,6 +227,27 @@ class CMSVideoTest(CMSVideoBaseTest):
...
@@ -225,6 +227,27 @@ class CMSVideoTest(CMSVideoBaseTest):
self
.
assertFalse
(
self
.
video
.
is_captions_visible
())
self
.
assertFalse
(
self
.
video
.
is_captions_visible
())
def
test_video_controls_shown_correctly
(
self
):
"""
Scenario: Video controls for all videos show correctly
Given I have created two Video components
And first is private video
When I reload the page
Then video controls for all videos are visible
"""
self
.
_create_course_unit
(
youtube_stub_config
=
{
'youtube_api_private_video'
:
True
})
self
.
video
.
create_video
()
# change id of first default video
self
.
edit_component
(
1
)
self
.
open_advanced_tab
()
self
.
video
.
set_field_value
(
'YouTube ID'
,
'sampleid123'
)
self
.
save_unit_settings
()
# again open unit page and check that video controls show for both videos
self
.
_navigate_to_course_unit_page
()
self
.
assertTrue
(
self
.
video
.
is_controls_visible
())
def
test_captions_shown_correctly
(
self
):
def
test_captions_shown_correctly
(
self
):
"""
"""
Scenario: Captions are shown correctly
Scenario: Captions are shown correctly
...
...
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