The ckplayer plug-in plays m3u8 videos and the ckplayer plug-in m3u8
Var flashvars = {f: 'ckplayer/m3u8.swf ', // use swf to send the video address to the player for playing a: 'video/m. m3u8', // m3u8 file c: 0, // call ckplayer. js configuration player p: 1, // automatically play video s: 4, // send the video stream address in the form of flash plug-in to the player for playing lv: 0, // note, if it is live, you need to set lv: 1 loaded: 'loadedhandler '}
Yesterday, I changed the downloaded m3u8 file to "m. in m3u8 format, set a to video/m. m3u8 can only play the video, but it cannot be played today, and continuous error reporting, such:
Var flashvars = {f: 'ckplayer/m3u8.swf ', // use swf to send the video address to the player for playing a: 'video/m3u8', // m3u8 file c: 0, // call ckplayer. js configuration player p: 1, // automatically play video s: 4, // send the video stream address in the form of flash plug-in to the player for playing lv: 0, // note, if it is live, you need to set lv: 1 loaded: 'loadedhandler '}
Then, I changed the m. m3u8 format to m3u8, and set a to video/m3u8. Instead, the video can be played. The browser console displays the following information:
Speechless. In the afternoon, you can play videos again in the m. m3u8 format ......
Var flashvars = {f: 'ckplayer/m3u8.swf ', // use swf to send a video address to the player for playing a: encodeURIComponent (decodeURIComponent ('HTTP: // pl.youku.com/playlist/m3u8? Ts = 1422522760 & keyframe = 0 & vid = XODc1NzMyNTA0 & type = mp4 & ep = %%%%3d % 3D & sid = 342252305536912b2f6dd & token = 3852 & ctype = 12 & ev = 1 & oip = 3663591661 ')), // m3u8 file c: 0, // call ckplayer. js configuration player p: 1, // automatically play video s: 4, // send the video stream address in the form of flash plug-in to the player for playing lv: 0, // note, if it is live, you need to set lv: 1 loaded: 'loadedhandler '}
I just solved the problem of playing m3u8 videos through external links.
For example, we get an external m3u8 link 1.
http://pl.youku.com/playlist/m3u8?ts=1422522760&keyframe=0&vid=XODc1NzMyNTA0&type=mp4&ep=cSaWGEyPVc4F4CDYgT8bNS60ciNbXJZ1gkyE%2F5gfScVAOejQmjbUxQ%3D%3D&sid=342252305537912b2f6dd&token=3852&ctype=12&ev=1&oip=3663591661
Some of the links are URI encoded.
First, we need to decode the decodeURIComponent () method to obtain link 2.
http://pl.youku.com/playlist/m3u8?ts=1422522760&keyframe=0&vid=XODc1NzMyNTA0&type=mp4&ep=cSaWGEyPVc4F4CDYgT8bNS60ciNbXJZ1gkyE/5gfScVAOejQmjbUxQ==&sid=342252305537912b2f6dd&token=3852&ctype=12&ev=1&oip=3663591661
Then, use the encodeURIComponent () method to encode the URI of the above link.
http%3A%2F%2Fpl.youku.com%2Fplaylist%2Fm3u8%3Fts%3D1422522760%26keyframe%3D0%26vid%3DXODc1NzMyNTA0%26type%3Dmp4%26ep%3DcSaWGEyPVc4F4CDYgT8bNS60ciNbXJZ1gkyE%2F5gfScVAOejQmjbUxQ%3D%3D%26sid%3D342252305537912b2f6dd%26token%3D3852%26ctype%3D12%26ev%3D1%26oip%3D3663591661
The above link can be used in ckplayer code.
Note that the URI encoding of link 1 cannot be performed directly, and the URL must be decoded Before encoding.
Because the first link may be partially encoded, if the link is directly encoded, the obtained link is different from the link obtained after decoding.
For example, we encode link 1 directly and get Link 4:
http%3A%2F%2Fpl.youku.com%2Fplaylist%2Fm3u8%3Fts%3D1422522760%26keyframe%3D0%26vid%3DXODc1NzMyNTA0%26type%3Dmp4%26ep%3DcSaWGEyPVc4F4CDYgT8bNS60ciNbXJZ1gkyE%252F5gfScVAOejQmjbUxQ%253D%253D%26sid%3D342252305537912b2f6dd%26token%3D3852%26ctype%3D12%26ev%3D1%26oip%3D3663591661
In comparison, Link 4 and link 3 are different. encodeURIComponent () encodes the percent sign % again.