Use the CKplayer plug-in to embed videos in webpages (note 2 ).
Sometimes we need to embed videos into webpages during website creation. Video embedding generally involves the following methods:
1. Youku code embedding
Advantages: simple, convenient, and reliable.
Disadvantages: There are advertisements. Today's websites are very user-oriented. If an online video is opened, long advertisements will surely crash.
2. embed a video using the <object> tag
Advantage: it is also convenient, and it is good for swf.
Disadvantage: if the video is played in wmv format, it will be funny to use Chrome to open it. Sometimes you will be prompted to install the media player Plug-in, and sometimes there will be no reminders. That is to say, cross-browser capabilities are insufficient.
Different video formats have different codes, which are too cumbersome.
3. Use the <video> label
Advantage: HTML5 new tags are good for mobile phones
Disadvantage: HTML5 <video> labels only support three formats and require encoding. In addition, if you want to implement video control, such as playback size, color, and playback drag, you must also write js Code.
4. Use the third-party Player Plug-in CKplayer
Advantages: supports most browsers, including video control, sharing, switching lights, and advertisement insertion. If you are a js bull, you can also modify various functions on your own.
Disadvantage: The best supported formats for ckplayer are MP4 videos encoded by H.264. Other formats have more or less minor issues.
Address: http://www.ckplayer.com
Note: before embedding the code, you must download the ckplayer folder and put it in the root directory.
Embedded code:
<div id="a1"></div> <script type="text/javascript" src="ckplayer/ckplayer.js" charset="utf-8"></script> <script type="text/javascript"> var flashvars = { f: '/Movie/123.mp4', c: 0, loaded: 'loadedHandler' }; var video = ['http://movie.ks.js.cn/flv/other/1_0.mp4->video/mp4']; CKobject.embed('ckplayer/ckplayer.swf', 'a1', 'ckplayer_a1', '600', '400', false, flashvars, video); </script>
F: enter your video address here;
Pay attention to the correctness of the src address and the correctness of the first swf address in embed.
If you do not want to expose the address of the local video on the page, you can use:
If you want to remove the adjustment, share, and switch the light settings, you can:
You can modify the LOGO in the middle of the player (it will appear when loading the player) And the LOGO in the upper right corner of the player:
For more features, you can go to the official website to view the development manual. I use such a function. I hope to give the code that worries me about embedding videos in my website.