How to capture the fifth second image of qiniu video as the cover image.

Source: Internet
Author: User
{Code ...}
// Introduce Plupload hideShowContent. var is_upload_video = 0; var is_upload_img = 0; var Qiniu = new QiniuJsSDK (); var uploader = Qiniu. uploader ({runtimes: 'html5, flash, html4', // upload mode, degradation browse_button: 'pickfiles' in turn, // click the button to upload the selected files, ** required ** uptoken_url: '/qiniu/get_up_token? Key = {$ path} & bucket_type = video', // Url of the Ajax request upToken. ** it is strongly recommended to set ** (provided by the server) // uptoken :'', // If uptoken_url is not specified, you must specify uptoken. uptoken is generated by other programs. // unique_names: true, // The default value is false, and key is the file name. If this option is enabled, the SDK automatically generates the uploaded key (file name ). // Save_key: true, // The default value is false. If 'sava _ key' is specified in the upload policy for the uptoken generated by the server, the SDK will ignore the key processing domain: '{$ video_domian }', // bucket domain name, used when downloading resources. ** required ** container: 'Container', // upload the dom id of the region. The default value is the parent element of browser_button. max_file_size: '60m', // maximum file size limit flash_swf_url: 'Public/js/plupload/Moxie.swf ', // introduce flash, relative path max_retries: 1, // maximum number of Retries for upload failure dragdrop: true, // you can drag the upload drop_element: 'Container', // drag the ID of the upload region element, after a file or folder is dragged, The chunk_size: '4mb 'can be triggered. // the size of each chunk_size is auto _ Start: true, // select the file and upload it automatically. If it is disabled, bind the event to trigger upload init: {'filesadded': function (up, files) {plupload. each (files, function (file) {// After the file is added to the queue, upload_pics_number ++; $ ('font _ video '). show (); if (upload_pics_number = 1) {$ ('# Support '). hide () ;}}) ;}, 'beforeupload': function (up, file) {// set the format and size of the uploaded file; $ array = ['video/mpmp', 'video/avi', 'video/mpg', 'image/gif']; if (-1 = jQuery. inArray (file. type, $ array) {alert ("Incorrect file format") window. location. reload (); return false;} if (file. size> 50*1024*1024) {alert ('upload file size cannot exceed 50m') window. location. reload (); return false;} is_upload_video = 1; $ ('# fsuploadprogressbox '). show (); $ ('# videobox '). hide ()}, 'uploadprogress': function (up, file) {var progress = new FileProgress (file, 'fsuploadprogress'); var chunk_size = plupload. parseSize (this. getOption ('chunk _ size'); progress. setPro Gress (file. percent + "%", up. total. bytesPerSec, chunk_size);}, 'fileuploaded': function (up, file, info) {$ ('# fsuploadprogressbox '). hide (); console. log (info); var dataObj = eval ("(" + info + ")"); if (dataObj. success = 'true') {$. getJSON ("/qiniu/get_video_pic_url? Key = {$ path} & bucket_type = pics ", function (json) {$ ('# video_thumbnail_input '). val (json. key); $ ('# Support '). show (); $ ('# product_video_qn '). val ('{$ path}'); $ ('font _ video '). hide (); $ ('# preview_video '). attr ('href ', "/product/video_show? Video_stream =/qiniu/get_video_url? Key = {$ path} & is_redirect = 1 "). show (); is_upload_video = 0 ;}) ;}else {alert ("Upload Failed, please upload again"); $ ('# support '). show (); $ ('font _ video '). show (); return false ;}}, 'error': function (up, err, errTip) {// when an upload Error occurs, process related tasks $ ('font _ video '). show (); $ ('# Support '). show (); alert (errTip) ;}, 'uploadcomplete': function () {$ ('# fsuploadprogressbox '). hide (); // after the team column file is processed, process the relevant event ('{videobox'}.html ('uploaded successfully'); chunk_index = 0 ;}, 'key': function (up, file) {// If You Want to personalize the key of each file on the front end, you can configure this function. // The configuration must be in unique_names: false, save_key: var key = "{$ path}"; // do something with key herereturn key }}});

Reply content:
// Introduce Plupload hideShowContent. var is_upload_video = 0; var is_upload_img = 0; var Qiniu = new QiniuJsSDK (); var uploader = Qiniu. uploader ({runtimes: 'html5, flash, html4', // upload mode, degradation browse_button: 'pickfiles' in turn, // click the button to upload the selected files, ** required ** uptoken_url: '/qiniu/get_up_token? Key = {$ path} & bucket_type = video', // Url of the Ajax request upToken. ** it is strongly recommended to set ** (provided by the server) // uptoken :'', // If uptoken_url is not specified, you must specify uptoken. uptoken is generated by other programs. // unique_names: true, // The default value is false, and key is the file name. If this option is enabled, the SDK automatically generates the uploaded key (file name ). // Save_key: true, // The default value is false. If 'sava _ key' is specified in the upload policy for the uptoken generated by the server, the SDK will ignore the key processing domain: '{$ video_domian }', // bucket domain name, used when downloading resources. ** required ** container: 'Container', // upload the dom id of the region. The default value is the parent element of browser_button. max_file_size: '60m', // maximum file size limit flash_swf_url: 'Public/js/plupload/Moxie.swf ', // introduce flash, relative path max_retries: 1, // maximum number of Retries for upload failure dragdrop: true, // you can drag the upload drop_element: 'Container', // drag the ID of the upload region element, after a file or folder is dragged, The chunk_size: '4mb 'can be triggered. // the size of each chunk_size is auto _ Start: true, // select the file and upload it automatically. If it is disabled, bind the event to trigger upload init: {'filesadded': function (up, files) {plupload. each (files, function (file) {// After the file is added to the queue, upload_pics_number ++; $ ('font _ video '). show (); if (upload_pics_number = 1) {$ ('# Support '). hide () ;}}) ;}, 'beforeupload': function (up, file) {// set the format and size of the uploaded file; $ array = ['video/mpmp', 'video/avi', 'video/mpg', 'image/gif']; if (-1 = jQuery. inArray (file. type, $ array) {alert ("Incorrect file format") window. location. reload (); return false;} if (file. size> 50*1024*1024) {alert ('upload file size cannot exceed 50m') window. location. reload (); return false;} is_upload_video = 1; $ ('# fsuploadprogressbox '). show (); $ ('# videobox '). hide ()}, 'uploadprogress': function (up, file) {var progress = new FileProgress (file, 'fsuploadprogress'); var chunk_size = plupload. parseSize (this. getOption ('chunk _ size'); progress. setPro Gress (file. percent + "%", up. total. bytesPerSec, chunk_size);}, 'fileuploaded': function (up, file, info) {$ ('# fsuploadprogressbox '). hide (); console. log (info); var dataObj = eval ("(" + info + ")"); if (dataObj. success = 'true') {$. getJSON ("/qiniu/get_video_pic_url? Key = {$ path} & bucket_type = pics ", function (json) {$ ('# video_thumbnail_input '). val (json. key); $ ('# Support '). show (); $ ('# product_video_qn '). val ('{$ path}'); $ ('font _ video '). hide (); $ ('# preview_video '). attr ('href ', "/product/video_show? Video_stream =/qiniu/get_video_url? Key = {$ path} & is_redirect = 1 "). show (); is_upload_video = 0 ;}) ;}else {alert ("Upload Failed, please upload again"); $ ('# support '). show (); $ ('font _ video '). show (); return false ;}}, 'error': function (up, err, errTip) {// when an upload Error occurs, process related tasks $ ('font _ video '). show (); $ ('# Support '). show (); alert (errTip) ;}, 'uploadcomplete': function () {$ ('# fsuploadprogressbox '). hide (); // after the team column file is processed, process the relevant event ('{videobox'}.html ('uploaded successfully'); chunk_index = 0 ;}, 'key': function (up, file) {// If You Want to personalize the key of each file on the front end, you can configure this function. // The configuration must be in unique_names: false, save_key: var key = "{$ path}"; // do something with key herereturn key }}});

For video interfaces, refer:
Http://developer.qiniu.com/docs/v6/api/reference/fop/av/vframe.html
Vframe is the synchronized fop.

For example for Video: http://rwxf.qiniudn.com/1.mp4

The fifth second of the external chain is: http://rwxf.qiniudn.com/1.mp4? Vframe/png/offset/5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.