diff --git a/source/Ox.UI/js/Video/VideoTimelinePlayer.js b/source/Ox.UI/js/Video/VideoTimelinePlayer.js index 5904ebeb..29fd349f 100644 --- a/source/Ox.UI/js/Video/VideoTimelinePlayer.js +++ b/source/Ox.UI/js/Video/VideoTimelinePlayer.js @@ -76,26 +76,48 @@ Ox.VideoTimelinePlayer = function(options, self) { self.lines = getLines(); // may update self.contentWidth self.videoLines = getVideoLines(); + if (Ox.isObject(self.options.video[0])) { + self.audioTracks = Ox.sort(Ox.unique( + self.options.video.map(function(video) { + return video.track; + }) + )).map(function(track) { + return { + id: track, + title: Ox._(track), + checked: self.options.audioTrack == track + }; + }); + } + self.$menubar = Ox.Bar({size: 16}); self.$menuButton = Ox.MenuButton({ - items: [ - {id: 'timelines', title: 'Timeline', disabled: true}, - {group: 'timeline', min: 1, max: 1, items: Ox.map( - self.options.timelines, - function(timeline) { - return Ox.extend({ - checked: timeline.id == self.options.timeline - }, timeline); + items: [].concat( + self.audioTracks.length > 1 ? [ + {id: 'audioTracks', title: Ox._('Audio'), items: [ + {group: 'audioTrack', min: 1, max: 1, items: self.audioTracks} + ]} + ] : [], + [ + {id: 'timelines', title: Ox._('Timeline'), items: [ + {group: 'timeline', min: 1, max: 1, items: Ox.map( + self.options.timelines, + function(timeline) { + return Ox.extend({ + checked: timeline.id == self.options.timeline + }, timeline); + } + )} + ]}, + {}, + { + id: 'followPlayer', + title: 'Follow Player While Playing', + checked: self.options.followPlayer } - )}, - {}, - { - id: 'followPlayer', - title: 'Follow Player While Playing', - checked: self.options.followPlayer - } - ], + ] + ), style: 'square', title: 'set', tooltip: Ox._('Options'), @@ -105,7 +127,10 @@ Ox.VideoTimelinePlayer = function(options, self) { .bindEvent({ change: function(data) { var id = data.id; - if (id == 'timeline') { + if (id == 'audioTrack') { + self.options.audioTrack = data.checked[0].id; + self.$video.options({audioTrack: self.options.audioTrack}); + } else if (id == 'timeline') { self.options.timeline = data.checked[0].id; updateTimeline(); that.triggerEvent('timeline', {