Recently, you need to append the video playback function to the homepage. Need to play YouTube videos. Encountered some twists and turns in the middle. Special to share.
First we add video files like Web pages and we usually use embed tags. You can set many key sub-keys in the tag. We can configure it as a flash plugin. But on the bottom version of the pad will not play the video properly.
The YouTube player API was later discovered. It's really a good thing.
Https://developers.google.com/youtube/player_parameters?hl=zh-CN
The embedded plugin plays the video. I have to say that flash is a good thing. But the pad does not play properly, our website developers are more headache things.
?
1 2 3 4 5 6 7 8 9 |
<
object width=
"425" height=
"344"
> <param name=
"movie" value=
"https://www.youtube.com/v/u1zgFlCw8Aw?fs=1"
</param> <param name=
"allowFullScreen" value=
"true"
></param> <embed src=
"https://www.youtube.com/v/u1zgFlCw8Aw?fs=1"
type=
"application/x-shockwave-flash"
allowfullscreen=
"true"
width=
"425" height=
"344"
> </embed> </
object
>
|
Because the pad can not watch the video so this program can only be discarded. So if you let the pad to see.
Https://developers.google.com/youtube/youtube_player_demo?hl=zh-CN
This page provides me with the main idea.
<iframe id= "Ytplayer" type= "text/html" width= "640" height= "360"
Src= "Https://www.youtube.com/embed/M7lc1UVf-VE"
Frameborder= "0" allowfullscreen> we achieve through Ifram. By testing him, we can play YouTube videos on both the PC and the pad.
There's some trouble playing the video. When we're done, YouTube will default to a list of other videos on our video trailer. In the embed we found a lot of configuration.
However, these attribute tags do not work when you play with YouTube. Then what to do. The programmer's hardships only you understand. Find it.
Https://developers.google.com/youtube/player_parameters?hl=zh-CN
When I saw this article, I had a light. Originally, YouTube was configured with URL parameters. What effect you want to pass the parameters.
Then put it into practice.
<iframe id="ytplayer" width="520 " height= " 317" src="https://www.youtube.com/embed/video number? rel=0&loop=1"> </iframe>
Rel Remove the other video list that is displayed after playing
Loop Loop Playback
Autostart finishes loading auto-play
Go and set yourself up.
Attached