forked from 0x2620/oxjs
implement 'show subtitles' functionality for players and timelines
This commit is contained in:
parent
b5a7b9b28d
commit
02b5b56be8
6 changed files with 83 additions and 40 deletions
|
|
@ -1399,7 +1399,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
position: self.options.position,
|
||||
results: self.results,
|
||||
showMilliseconds: self.options.showMilliseconds,
|
||||
subtitles: self.options.subtitles,
|
||||
subtitles: self.options.enableSubtitles ? self.options.subtitles : [],
|
||||
timeline: self.options.timeline,
|
||||
type: 'player',
|
||||
width: getTimelineWidth()
|
||||
|
|
@ -1768,11 +1768,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
if (title == 'Download') {
|
||||
that.triggerEvent('download');
|
||||
} else if (title == 'Subtitles') {
|
||||
self.options.enableSubtitles = !self.options.enableSubtitles;
|
||||
setSubtitle();
|
||||
that.triggerEvent('subtitles', {
|
||||
subtitles: self.options.enableSubtitles
|
||||
});
|
||||
toggleSubtitles();
|
||||
} else {
|
||||
resolution = parseInt(title);
|
||||
if (resolution != self.options.resolution) {
|
||||
|
|
@ -2342,12 +2338,26 @@ Ox.VideoPlayer = function(options, self) {
|
|||
});
|
||||
}
|
||||
|
||||
function toggleSubtitles() {
|
||||
self.options.enableSubtitles = !self.options.enableSubtitles;
|
||||
setSubtitle();
|
||||
self.$timeline && self.$timeline.options({
|
||||
subtitles: self.options.enableSubtitles ? self.options.subtitles : []
|
||||
});
|
||||
that.triggerEvent('subtitles', {
|
||||
subtitles: self.options.enableSubtitles
|
||||
});
|
||||
}
|
||||
|
||||
function toggleVolume() {
|
||||
self.$volume.toggle();
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'find') {
|
||||
if (key == 'enableSubtitles') {
|
||||
self.options.enableSubtitles = !self.options.enableSubtitles;
|
||||
toggleSubtitles();
|
||||
} if (key == 'find') {
|
||||
setSubtitleText();
|
||||
} else if (key == 'fullscreen') {
|
||||
self.options.fullscreen = !self.options.fullscreen;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue