Skip to content

Commit

Permalink
add an option for setting default volume
Browse files Browse the repository at this point in the history
  • Loading branch information
yumpyy committed Jul 25, 2024
1 parent a8e34ff commit 642b0a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@
'category': 'playback',
}),

('default_volume', {
'type': int,
'default': 100,
'max': 100,
'min': 0,
'comment': 'Sets a default volume. Defaults to 100.',
'category': 'playback',
}),

('related_videos_mode', {
'type': int,
'default': 1,
Expand Down
1 change: 1 addition & 0 deletions youtube/static/js/plyr-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const player = new Plyr(document.querySelector('video'), {
enabled: storyboard_url != null,
src: [storyboard_url],
},
volume: data.settings.default_volume / 100,
settings: ['captions', 'quality', 'speed', 'loop'],
});

Expand Down
2 changes: 2 additions & 0 deletions youtube/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ <h2>{{ categ|capitalize }}</h2>
<option value="{{ option[0] }}" {{ 'selected' if option[0] == value else '' }}>{{ option[1] }}</option>
{% endfor %}
</select>
{% elif 'max' in setting_info and 'min' in setting_info %}
<input type="number" id="{{ 'setting_' + setting_name }}" name="{{ setting_name }}" value="{{ value }}" min="{{ setting_info['min'] }}" max="{{ setting_info['max'] }}">
{% else %}
<input type="number" id="{{ 'setting_' + setting_name }}" name="{{ setting_name }}" value="{{ value }}" step="1">
{% endif %}
Expand Down

0 comments on commit 642b0a4

Please sign in to comment.