add audio tracks submenu to timeline player

This commit is contained in:
rlx 2014-09-02 14:09:34 +02:00
parent a04c0f2a1f
commit 923a9ea706

View file

@ -76,26 +76,48 @@ Ox.VideoTimelinePlayer = function(options, self) {
self.lines = getLines(); // may update self.contentWidth self.lines = getLines(); // may update self.contentWidth
self.videoLines = getVideoLines(); 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.$menubar = Ox.Bar({size: 16});
self.$menuButton = Ox.MenuButton({ self.$menuButton = Ox.MenuButton({
items: [ items: [].concat(
{id: 'timelines', title: 'Timeline', disabled: true}, self.audioTracks.length > 1 ? [
{group: 'timeline', min: 1, max: 1, items: Ox.map( {id: 'audioTracks', title: Ox._('Audio'), items: [
self.options.timelines, {group: 'audioTrack', min: 1, max: 1, items: self.audioTracks}
function(timeline) { ]}
return Ox.extend({ ] : [],
checked: timeline.id == self.options.timeline [
}, timeline); {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', style: 'square',
title: 'set', title: 'set',
tooltip: Ox._('Options'), tooltip: Ox._('Options'),
@ -105,7 +127,10 @@ Ox.VideoTimelinePlayer = function(options, self) {
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
var id = data.id; 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; self.options.timeline = data.checked[0].id;
updateTimeline(); updateTimeline();
that.triggerEvent('timeline', { that.triggerEvent('timeline', {