Using youtube api (v3) instead of v2 to get the video duration .

TNL-2413
This commit is contained in:
muzaffaryousaf
2015-06-23 14:23:15 +05:00
parent 69a1a069e9
commit 7dfd567cb5
30 changed files with 222 additions and 148 deletions

View File

@@ -3,7 +3,7 @@ Feature: LMS.Video component
As a student, I want to view course videos in LMS
# 1
Scenario: Verify that each video in each sub-section includes a transcript for non-Youtube countries
Scenario: Verify that each video in sub-section includes a transcript for Youtube and non-Youtube countries
Given youtube server is up and response time is 2 seconds
And I am registered for the course "test_course"
And I have a "subs_3_yD_cEKoCk.srt.sjson" transcript file in assets
@@ -24,9 +24,9 @@ Feature: LMS.Video component
| Welcome to edX. |
| Equal transcripts |
When I open video "C"
Then the video has rendered in "HTML5" mode
Then the video has rendered in "YOUTUBE" mode
And I make sure captions are opened
And I see " " text in the captions
When I open video "D"
Then the video has rendered in "HTML5" mode
And the video does not show the captions
Then the video has rendered in "YOUTUBE" mode
And I make sure captions are opened

View File

@@ -62,8 +62,9 @@ class TestVideoYouTube(TestVideo):
"transcriptLanguage": "en",
"transcriptLanguages": OrderedDict({"en": "English", "uk": u"Українська"}),
"ytTestTimeout": 1500,
"ytApiUrl": "www.youtube.com/iframe_api",
"ytTestUrl": "gdata.youtube.com/feeds/api/videos/",
"ytApiUrl": "https://www.youtube.com/iframe_api",
"ytMetadataUrl": "https://www.googleapis.com/youtube/v3/videos/",
"ytKey": None,
"transcriptTranslationUrl": self.item_descriptor.xmodule_runtime.handler_url(
self.item_descriptor, 'transcript', 'translation/__lang__'
).rstrip('/?'),
@@ -139,8 +140,9 @@ class TestVideoNonYouTube(TestVideo):
"transcriptLanguage": "en",
"transcriptLanguages": OrderedDict({"en": "English"}),
"ytTestTimeout": 1500,
"ytApiUrl": "www.youtube.com/iframe_api",
"ytTestUrl": "gdata.youtube.com/feeds/api/videos/",
"ytApiUrl": "https://www.youtube.com/iframe_api",
"ytMetadataUrl": "https://www.googleapis.com/youtube/v3/videos/",
"ytKey": None,
"transcriptTranslationUrl": self.item_descriptor.xmodule_runtime.handler_url(
self.item_descriptor, 'transcript', 'translation/__lang__'
).rstrip('/?'),
@@ -192,8 +194,9 @@ class TestGetHtmlMethod(BaseTestXmodule):
"transcriptLanguage": "en",
"transcriptLanguages": OrderedDict({"en": "English"}),
"ytTestTimeout": 1500,
"ytApiUrl": "www.youtube.com/iframe_api",
"ytTestUrl": "gdata.youtube.com/feeds/api/videos/",
"ytApiUrl": "https://www.youtube.com/iframe_api",
"ytMetadataUrl": "https://www.googleapis.com/youtube/v3/videos/",
"ytKey": None,
"transcriptTranslationUrl": self.item_descriptor.xmodule_runtime.handler_url(
self.item_descriptor, 'transcript', 'translation/__lang__'
).rstrip('/?'),
@@ -1181,8 +1184,9 @@ class TestVideoWithBumper(TestVideo):
"transcriptLanguage": "en",
"transcriptLanguages": OrderedDict({"en": "English", "uk": u"Українська"}),
"ytTestTimeout": 1500,
"ytApiUrl": "www.youtube.com/iframe_api",
"ytTestUrl": "gdata.youtube.com/feeds/api/videos/",
"ytApiUrl": "https://www.youtube.com/iframe_api",
"ytMetadataUrl": "https://www.googleapis.com/youtube/v3/videos/",
"ytKey": None,
"transcriptTranslationUrl": self.item_descriptor.xmodule_runtime.handler_url(
self.item_descriptor, 'transcript', 'translation/__lang__'
).rstrip('/?'),

View File

@@ -175,8 +175,8 @@ XQUEUE_INTERFACE = {
}
# Point the URL used to test YouTube availability to our stub YouTube server
YOUTUBE['API'] = "127.0.0.1:{0}/get_youtube_api/".format(YOUTUBE_PORT)
YOUTUBE['TEST_URL'] = "127.0.0.1:{0}/test_youtube/".format(YOUTUBE_PORT)
YOUTUBE['API'] = "http://127.0.0.1:{0}/get_youtube_api/".format(YOUTUBE_PORT)
YOUTUBE['METADATA_URL'] = "http://127.0.0.1:{0}/test_youtube/".format(YOUTUBE_PORT)
YOUTUBE['TEXT_API']['url'] = "127.0.0.1:{0}/test_transcripts_youtube/".format(YOUTUBE_PORT)
if FEATURES.get('ENABLE_COURSEWARE_SEARCH') or \

View File

@@ -632,6 +632,7 @@ FACEBOOK_APP_ID = AUTH_TOKENS.get("FACEBOOK_APP_ID")
XBLOCK_SETTINGS = ENV_TOKENS.get('XBLOCK_SETTINGS', {})
XBLOCK_SETTINGS.setdefault("VideoDescriptor", {})["licensing_enabled"] = FEATURES.get("LICENSING", False)
XBLOCK_SETTINGS.setdefault("VideoModule", {})['YOUTUBE_API_KEY'] = AUTH_TOKENS.get('YOUTUBE_API_KEY', YOUTUBE_API_KEY)
##### CDN EXPERIMENT/MONITORING FLAGS #####
CDN_VIDEO_URLS = ENV_TOKENS.get('CDN_VIDEO_URLS', CDN_VIDEO_URLS)

View File

@@ -131,8 +131,8 @@ FEATURES['ENTRANCE_EXAMS'] = True
# Point the URL used to test YouTube availability to our stub YouTube server
YOUTUBE_PORT = 9080
YOUTUBE['API'] = "127.0.0.1:{0}/get_youtube_api/".format(YOUTUBE_PORT)
YOUTUBE['TEST_URL'] = "127.0.0.1:{0}/test_youtube/".format(YOUTUBE_PORT)
YOUTUBE['API'] = "http://127.0.0.1:{0}/get_youtube_api/".format(YOUTUBE_PORT)
YOUTUBE['METADATA_URL'] = "http://127.0.0.1:{0}/test_youtube/".format(YOUTUBE_PORT)
YOUTUBE['TEXT_API']['url'] = "127.0.0.1:{0}/test_transcripts_youtube/".format(YOUTUBE_PORT)
############################# SECURITY SETTINGS ################################

View File

@@ -1751,10 +1751,10 @@ EMAIL_OPTIN_MINIMUM_AGE = PARENTAL_CONSENT_AGE_LIMIT
YOUTUBE = {
# YouTube JavaScript API
'API': 'www.youtube.com/iframe_api',
'API': 'https://www.youtube.com/iframe_api',
# URL to test YouTube availability
'TEST_URL': 'gdata.youtube.com/feeds/api/videos/',
# URL to get YouTube metadata
'METADATA_URL': 'https://www.googleapis.com/youtube/v3/videos/',
# Current youtube api for requesting transcripts.
# For example: http://video.google.com/timedtext?lang=en&v=j_jEn79vS3g.
@@ -1768,6 +1768,7 @@ YOUTUBE = {
'IMAGE_API': 'http://img.youtube.com/vi/{youtube_id}/0.jpg', # /maxresdefault.jpg for 1920*1080
}
YOUTUBE_API_KEY = None
################################### APPS ######################################
INSTALLED_APPS = (

View File

@@ -61,6 +61,7 @@ lib_paths:
- xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min.js
- xmodule_js/common_static/js/test/i18n.js
- xmodule_js/common_static/js/vendor/date.js
- xmodule_js/common_static/js/vendor/moment.min.js
# Paths to source JavaScript files
src_paths:

View File

@@ -50,6 +50,7 @@
"URI": "js/vendor/URI.min",
"string_utils": "js/src/string_utils",
"utility": "js/src/utility",
"moment": "js/vendor/moment.min",
// Files needed by OVA
"annotator": "js/vendor/ova/annotator-full",