Mentre le risposte che suggeriscono di eseguire il re-rendering in qualsiasi modo potrebbero risolvere il problema, se si ha accesso all'API del lettore sarebbe bello vedere se l'interruzione del video nella schermata willDestroyElement
non verrà risolta quella.
Inoltre si potrebbe avere il lettore video sia una componente Ember, garantendo una buona messa a punto, teardown e aggiornamento:
App.VideoPlayerComponent = Ember.Component.extend({
source: null, // used in the template using that component
isPlayerReady: false, // used to know internally if the player is ready
setupPlayer: (function(){
// somehow setup the video player if needed
// (if Flash player for example, make the flash detection and whatever)
// once ready, trigger our `videoPlayerReady` event
this.set('isPlayerReady', true);
this.trigger('videoPlayerReady');
}).on('didInsertElement'),
updatePlayerSource: (function(){
// start playing if we have a source and our player is ready
if (this.get('isPlayerReady') && this.get('source'))
{
// replace with the correct js to start the video
this.$('.class-of-player').videoPlay(this.get('source'));
}
}).observes('source').on('videoPlayerReady'),
teardownSource: (function(){
// stop playing if our player is ready since our source is going to change
if (this.get('source') && this.get('isPlayerReady'))
{
// replace with the correct js to stop the player
this.$('.class-of-player').videoStop();
}
}).observesBefore('source'),
teardownPlayer: (function(){
// teardown the player somehow (do the opposite of what is setup in `setupPlayer`)
// then register that our player isn't ready
this.set('isPlayerReady', false);
}).on('willDestroyElement')
});
Questo vi permetterà di essere sicuri che tutto sia impostato e teardown correttamente, e dato che è un componente puoi riutilizzare, sarà molto facile avere un ripiego su un flash player, per esempio.Quindi tutto ciò che si deve gestire e risolvere cose relative al giocatore, sarà a tale componente, e ti resta che sostituire la parte del vostro modello con il giocatore con:
{{video-player source=ctrl.videoUrl}}
La mia ipotesi è che il tag di origine non supporta dinamicamente modificare lo src dopo che è caricato . – Kingpin2k
http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#the-source-element, Modifica dinamica di un elemento di origine e del relativo attributo quando l'elemento è già inserito in un video o l'elemento audio non avrà alcun effetto. – Kingpin2k
Interessante @ Kingpin2k Come si può risolvere in modo "ember"? –