2013-10-20 87 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

相关问题