Fixed media pausing behaviour when clicking the conversation list
This commit changes the inbox to stop video and audio elements when selecting a new conversation, and to not stop such elements when the same conversation was selected (fixes #391). // FREEBIE
This commit is contained in:
parent
005444d09a
commit
d5b003a15e
1 changed files with 17 additions and 8 deletions
|
@ -38,16 +38,25 @@
|
||||||
Whisper.ConversationStack = Whisper.View.extend({
|
Whisper.ConversationStack = Whisper.View.extend({
|
||||||
className: 'conversation-stack',
|
className: 'conversation-stack',
|
||||||
open: function(conversation) {
|
open: function(conversation) {
|
||||||
var $el = this.$('#conversation-' + conversation.cid);
|
var id = 'conversation-' + conversation.cid;
|
||||||
if ($el === null || $el.length === 0) {
|
if(id !== this.el.firstChild.id) {
|
||||||
var view = new Whisper.ConversationView({
|
this.$("video").each(function() {
|
||||||
model: conversation,
|
this.pause();
|
||||||
appWindow: this.model.appWindow
|
|
||||||
});
|
});
|
||||||
$el = view.$el;
|
this.$("audio").each(function() {
|
||||||
|
this.pause();
|
||||||
|
});
|
||||||
|
var $el = this.$('#'+id);
|
||||||
|
if ($el === null || $el.length === 0) {
|
||||||
|
var view = new Whisper.ConversationView({
|
||||||
|
model: conversation,
|
||||||
|
appWindow: this.model.appWindow
|
||||||
|
});
|
||||||
|
$el = view.$el;
|
||||||
|
}
|
||||||
|
$el.prependTo(this.el);
|
||||||
|
conversation.trigger('opened');
|
||||||
}
|
}
|
||||||
$el.prependTo(this.el);
|
|
||||||
conversation.trigger('opened');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue