2013-10-20 84 views
1

我曾嘗試 -如何燼應用程序中播放YouTube視頻

型號 -

App.Video = DS.Model.extend({ 
    url: DS.attr('string'), 
}); 

路由器 -

App.VideoRoute = Ember.Route.extend({ 
    model: function() { 
    return App.Video.find(); 
    }, 
}); 

的index.html -

<script type="text/x-handlebars" id="video"> 
    <div class='about'> 
    {{#each model}} 
     <embed 
     width="420" height="345" 
     src= "{{url}}" 
     type="application/x-shockwave-flash"> 
     </embed> 
    {{/each}} 
</div> 
</script> 

我從服務器端的JSON響應 -

{ 'id': '1', 'url': 'http://www.youtube.com/v/GnzZyGQi2ps' } 

但是,如果我在上面的句柄中給出'http://www.youtube.com/v/GnzZyGQi2ps'的src,那麼它的播放。

任何人都可以幫助我如何解決這個問題?

回答

1

使用{{unbound url}}避免腳本的Metamorph標籤:

<script type="text/x-handlebars" id="video"> 
    <div class='about'> 
    {{#each model}} 
     <embed 
     width="420" height="345" 
     src="{{unbound url}}" 
     type="application/x-shockwave-flash"> 
     </embed> 
    {{/each}} 
    </div> 
</script> 

希望它能幫助。

+0

非常感謝。它是戰鬥機。 – user2709881

相關問題