@@ -11,7 +11,6 @@ const EXTENSION = 'mp4'
11
11
const EXTENSION_SUBS = 'vtt'
12
12
13
13
const qualities = [ '1280x720' , '1024x768' ]
14
- const DEFAULT_QUALITY = qualities [ 0 ]
15
14
16
15
const DOWNLOAD_TIMEOUT = 3000
17
16
let DURATION_PERCENT = 10 // percent max 100
@@ -119,6 +118,8 @@ const readIsLeadingZeroAlways = () => {
119
118
return false ;
120
119
}
121
120
121
+ const readCourseType = ( ) => readSharedValue ( 'courseType' )
122
+
122
123
const log = ( message , type = 'STATUS' ) => console . log ( `[${ APPNAME } ]:[${ type } ]: ${ message } ` )
123
124
124
125
const replaceQuotesWithSquareBrackets = name => {
@@ -169,6 +170,11 @@ const getCurrentVideoId = () => {
169
170
// END:UTILITIES
170
171
// ====================================================================
171
172
173
+ const getQuality = async ( ) => {
174
+ const courseType = await readCourseType ( ) ;
175
+ return courseType === "Old" ? qualities [ 1 ] : qualities [ 0 ] ;
176
+ }
177
+
172
178
const getDirectoryName = ( sectionIndex , sectionName , bPadding = false ) => {
173
179
let padIndex = `${ sectionIndex + 1 } `
174
180
if ( bPadding ) {
@@ -187,6 +193,7 @@ const getFileName = (videoIndex, videoName, bPadding = false) => {
187
193
188
194
const getVideoURL = async videoId => {
189
195
try {
196
+ const quality = await getQuality ( ) ;
190
197
const response = await fetch ( viewclipURL , {
191
198
method : 'POST' ,
192
199
headers : {
@@ -195,7 +202,7 @@ const getVideoURL = async videoId => {
195
202
body : JSON . stringify ( {
196
203
clipId : videoId ,
197
204
mediaType : EXTENSION ,
198
- quality : DEFAULT_QUALITY ,
205
+ quality : quality ,
199
206
online : true ,
200
207
boundedContext : 'course' ,
201
208
versionId : '' ,
0 commit comments