Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, April 9th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a470a62d
Commit
a470a62d
authored
12 years ago
by
David Ormsbee
Browse files
Options
Downloads
Patches
Plain Diff
Hack to disable YouTube <iframe> API when they break it.
parent
e5fda33e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common/lib/xmodule/xmodule/video_module.py
+13
-1
13 additions, 1 deletion
common/lib/xmodule/xmodule/video_module.py
lms/envs/common.py
+3
-0
3 additions, 0 deletions
lms/envs/common.py
lms/templates/video.html
+11
-1
11 additions, 1 deletion
lms/templates/video.html
with
27 additions
and
2 deletions
common/lib/xmodule/xmodule/video_module.py
+
13
−
1
View file @
a470a62d
...
...
@@ -128,6 +128,17 @@ class VideoModule(XModule):
else
:
caption_asset_path
=
StaticContent
.
get_base_url_path_for_course_assets
(
self
.
location
)
+
'
/subs_
'
# We normally let JS parse this, but in the case that we need a hacked
# out <object> player because YouTube has broken their <iframe> API for
# the third time in a year, we need to extract it server side.
normal_speed_video_id
=
None
# The 1.0 speed video
# video_list() example:
# "0.75:nugHYNiD3fI,1.0:7m8pab1MfYY,1.25:3CxdPGXShq8,1.50:F-D7bOFCnXA"
for
video_id_str
in
self
.
video_list
().
split
(
"
,
"
):
if
video_id_str
.
startswith
(
"
1.0:
"
):
normal_speed_video_id
=
video_id_str
.
split
(
"
:
"
)[
1
]
return
self
.
system
.
render_template
(
'
video.html
'
,
{
'
streams
'
:
self
.
video_list
(),
'
id
'
:
self
.
location
.
html_id
(),
...
...
@@ -140,7 +151,8 @@ class VideoModule(XModule):
'
caption_asset_path
'
:
caption_asset_path
,
'
show_captions
'
:
self
.
show_captions
,
'
start
'
:
self
.
start_time
,
'
end
'
:
self
.
end_time
'
end
'
:
self
.
end_time
,
'
normal_speed_video_id
'
:
normal_speed_video_id
})
...
...
This diff is collapsed.
Click to expand it.
lms/envs/common.py
+
3
−
0
View file @
a470a62d
...
...
@@ -81,6 +81,9 @@ MITX_FEATURES = {
'
AUTH_USE_OPENID
'
:
False
,
'
AUTH_USE_MIT_CERTIFICATES
'
:
False
,
'
AUTH_USE_OPENID_PROVIDER
'
:
False
,
# When the YouTube iframe API breaks
'
USE_YOUTUBE_OBJECT_API
'
:
True
,
}
# Used for A/B testing
...
...
This diff is collapsed.
Click to expand it.
lms/templates/video.html
+
11
−
1
View file @
a470a62d
...
...
@@ -2,9 +2,19 @@
<h2>
${display_name}
</h2>
% endif
%if settings.MITX_FEATURES['STUB_VIDEO_FOR_TESTING']:
<div
id=
"stub_out_video_for_testing"
></div>
%elif settings.MITX_FEATURES.get('USE_YOUTUBE_OBJECT_API') and normal_speed_video_id:
<object
width=
"640"
height=
"390"
>
<param
name=
"movie"
value=
"https://www.youtube.com/v/${normal_speed_video_id}?version=3&autoplay=1&rel=0"
></param>
<param
name=
"allowScriptAccess"
value=
"always"
></param>
<embed
src=
"https://www.youtube.com/v/${normal_speed_video_id}?version=3&autoplay=1&rel=0"
type=
"application/x-shockwave-flash"
allowscriptaccess=
"always"
width=
"640"
height=
"390"
></embed>
</object>
%else:
<div
id=
"video_${id}"
class=
"video"
data-streams=
"${streams}"
data-caption-data-dir=
"${data_dir}"
data-show-captions=
"${show_captions}"
data-start=
"${start}"
data-end=
"${end}"
data-caption-asset-path=
"${caption_asset_path}"
>
<div
class=
"tc-wrapper"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment