问题
I want to add a youtube video in my site using Sencha. I use the following code:
var pnl = new Ext.Panel({
layout: {
type: 'vbox',
pack: 'center'
},
items: [{
xtype:'video',
url: "space.mp4",
loop: true,
width: 500,
height: 400,
poster: 'Screenshot.png'
}],
fullscreen: true
})
Here I replace the space.mp4
with a youtube url but it doesn't work. If I write html:'you tube link'
, it works on the browser on my system, but not on iPhone.
How can I make this work?
回答1:
One workaround is to embed the video with the embed code (iframe) provided by youtube. Just give your component the html attribute with the iframe code, e.g.:
html: '<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/1VcZ5eOwHQA" frameborder="0" allowfullscreen></iframe>'
来源:https://stackoverflow.com/questions/3957250/adding-video-using-sencha