Skip to content

Commit

Permalink
update Youtube video (previously 144p, 240p, 360p to 240p, 360p, 480p)
Browse files Browse the repository at this point in the history
  • Loading branch information
vico - low web committed Feb 3, 2020
1 parent 571956b commit 15ff98f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/scripts/content_script/video/custom-players.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export default function() {
if (video.id === 'youtube') {
switch (store.getters.video_quality) {
case 1:
jsUrl = jsUrl.replace('.js', '-tiny.js');
jsUrl = jsUrl.replace('.js', '-small.js');
break;
case 2:
jsUrl = jsUrl.replace('.js', '-small.js');
jsUrl = jsUrl.replace('.js', '-medium.js');
break;
case 3:
jsUrl = jsUrl.replace('.js', '-medium.js');
jsUrl = jsUrl.replace('.js', '-large.js');
break;
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/content_script/video/players/Youtube-large.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// TODO generate youtube script (Youtube-small.js,Youtube-medium.js,Youtube-large.js) from common source
(function() {
function setQuality() {
let player = document.getElementById('movie_player') || document.querySelector('.ytp-embed');
if (player && typeof player.setPlaybackQualityRange === 'function') {
player.setPlaybackQualityRange('large');
}
}
document.body.addEventListener('yt-navigate-finish', event => {
setQuality();
});
setQuality();
})();
2 changes: 1 addition & 1 deletion src/scripts/content_script/video/players/Youtube-medium.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO generate youtube script (Youtube-tiny.js,Youtube-small.js,Youtube-medium.js) from common source
// TODO generate youtube script (Youtube-small.js,Youtube-medium.js,Youtube-large.js) from common source
(function() {
function setQuality() {
let player = document.getElementById('movie_player') || document.querySelector('.ytp-embed');
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/content_script/video/players/Youtube-small.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO generate youtube script (Youtube-tiny.js,Youtube-small.js,Youtube-medium.js) from common source
// TODO generate youtube script (Youtube-small.js,Youtube-medium.js,Youtube-large.js) from common source
(function() {
function setQuality() {
let player = document.getElementById('movie_player') || document.querySelector('.ytp-embed');
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/content_script/video/players/Youtube-tiny.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function setQuality() {
let player = document.getElementById('movie_player') || document.querySelector('.ytp-embed');
if (player && typeof player.setPlaybackQualityRange === 'function') {
player.setPlaybackQualityRange('tiny');
player.setPlaybackQualityRange('small');
}
}
document.body.addEventListener('yt-navigate-finish', event => {
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const config = {
'oembed/style': './styles/embed.js',

'players/Youtube': './scripts/content_script/video/players/Youtube-medium.js',
'players/Youtube-tiny': './scripts/content_script/video/players/Youtube-tiny.js',
'players/Youtube-small': './scripts/content_script/video/players/Youtube-small.js',
'players/Youtube-medium': './scripts/content_script/video/players/Youtube-medium.js',

'players/Youtube-large': './scripts/content_script/video/players/Youtube-large.js',

// 'players/Dailymotion': './scripts/content_script/video/players/Dailymotion.js',
// 'players/Youporn': './scripts/content_script/video/players/Youporn.js',
// 'players/Vimeo': './scripts/content_script/video/players/Vimeo.js',
Expand Down

0 comments on commit 15ff98f

Please sign in to comment.