{"id":2779,"date":"2018-05-06T18:06:04","date_gmt":"2018-05-06T10:06:04","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2779"},"modified":"2018-05-06T18:06:04","modified_gmt":"2018-05-06T10:06:04","slug":"mobilevlckit%e5%92%8cvlckit%e5%a4%84%e7%90%86%e5%bf%ab%e7%85%a7%e5%92%8c%e7%bc%a9%e7%95%a5%e5%9b%be","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2779","title":{"rendered":"MobileVLCKit\u548cVLCKit\u5904\u7406\u5feb\u7167\u548c\u7f29\u7565\u56fe"},"content":{"rendered":"<p>\n\t<font><font>\u4eca\u5929\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u89c6\u9891\u5185\u5bb9\u7684\u7f29\u7565\u56fe\u3002<\/font><font>\u6211\u4eec\u9700\u8981\u533a\u5206\u4e24\u4e2a\u5173\u952e\u65b9\u9762\uff1a\u4fdd\u5b58\u5f53\u524d\u6b63\u5728\u64ad\u653e\u7684\u89c6\u9891\uff08\u5feb\u7167\uff09\u7684\u9759\u6001\u56fe\u50cf\u548c\u9884\u89c8\u672a\u64ad\u653e\u65f6\u5b58\u50a8\u5728\u67d0\u5904\u7684\u5a92\u4f53\uff08\u7f29\u7565\u56fe\uff09\u3002<\/font><font>\u65e0\u8bba\u54ea\u79cd\u65b9\u5f0f\uff0cVLCKit\u90fd\u4f1a\u6253\u5f00\u8d44\u6e90\uff0c\u89e3\u7801\u6bd4\u7279\u6d41\u5e76\u4e3a\u60a8\u63d0\u4f9b\u56fe\u50cf\uff0c\u6027\u80fd\u548c\u53ef\u7528\u6027\u4f1a\u6709\u6240\u4e0d\u540c\u3002<\/font><\/font>\n<\/p>\n<h2>\n\t<font><font>\u7f29\u7565\u56fe<\/font><\/font><br \/>\n<\/h2>\n<p>\n\t<font><font>\u8ba9\u6211\u4eec\u5148\u7f29\u7565\u4e00\u4e2a\u975e\u64ad\u653e\u5a92\u4f53\u6765\u6e90\uff0c\u5b83\u53ef\u4ee5\u5b58\u50a8\u5728\u672c\u5730\u6216\u8fdc\u7a0b\u3002<\/font><\/font>\n<\/p>\n<pre class=\"brush:cpp;\">\r\n@implementation DummyObject &lt;VLCMediaThumbnailerDelegate&gt;\r\n\r\n- (void)workerMethod\r\n{\r\n    \/\/ 1\r\n    NSURL *url = [NSURL urlWithString:@\"\"];\r\n    VLCMedia *media = [VLCMedia mediaWithURL:url];\r\n\r\n    \/\/ 2\r\n    VLCMediaThumbnailer *thumbnailer = [VLCMediaThumbnailer thumbnailerWithMedia:media delegate:self];\r\n\r\n    \/\/ 3\r\n    CGSize thumbSize = CGSizeMake(800.,600.);\r\n    thumbnailer.thumbnailWidth = thumbSize.width;\r\n    thumbnailer.thumbnailHeight = thumbSize.height;\r\n\r\n    \/\/ 4\r\n    [thumbnailer fetchThumbnail];\r\n}\r\n\r\n- (void)mediaThumbnailer:(VLCMediaThumbnailer *)mediaThumbnailer didFinishThumbnail:(CGImageRef)thumbnail\r\n{\r\n    \/\/ 5\r\n    if (thumbnail) {\r\n        UIImage *thumbnailImage = [UIImage imageWithCGImage:thumbnail scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp];\r\n        if (thumbnailImage) {\r\n            \/\/ TODO: do something with the thumbnail!\r\n        }\r\n    }\r\n}\r\n\r\n- (void)mediaThumbnailerDidTimeOut:(VLCMediaThumbnailer *)mediaThumbnailer\r\n{\r\n     \/\/ TODO: Show a reaction\r\n}\r\n\r\n@end<\/pre>\n<ol>\n<li>\n\t\t<font><font>\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2aNSURL\u5b9e\u4f8b\u4ee5\u53ca\u5b83\u7684VLCMedia\u8868\u793a\u3002<\/font><font>\u8bf7\u6ce8\u610f\uff0cURL\u53ef\u80fd\u6307\u5411\u672c\u5730\u8d44\u6e90\u6216\u8fdc\u7a0b\u8d44\u6e90\u3002<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<font><font>\u6211\u4eec\u4e3a\u6211\u4eec\u7684\u5a92\u4f53\u521b\u5efa\u7f29\u7565\u56fe\u5b9e\u4f8b\uff0c\u5e76\u5c06\u81ea\u5df1\u6307\u5b9a\u4e3a\u59d4\u6258\u4eba\u4ee5\u63a5\u6536\u7f29\u7565\u56fe\u3002<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<font><font>\u6211\u4eec\u5b9a\u4e49\u751f\u6210\u7684\u7f29\u7565\u56fe\u7684\u5927\u5c0f\u3002&nbsp;<\/font><\/font><font><font>&nbsp;\u5982\u679c\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u8bbe\u7f6e\u4e3a\u96f6\uff0c\u5219\u4f1a\u4f7f\u7528\u89c6\u9891\u7684\u539f\u59cb\u5927\u5c0f\u3002<\/font><font>\u5982\u679c\u5c06\u5bbd\u5ea6\u6216\u9ad8\u5ea6\u8bbe\u7f6e\u4e3a\u96f6\uff0c\u5219<\/font><\/font><font><font>\u7eb5\u6a2a\u6bd4\u5c06\u4fdd\u7559\u3002<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<font><font>\u6700\u540e\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3a\u7f29\u7565\u56fe\u7684\u5de5\u4f5c\u4eba\u5458\u529f\u80fd\u3002<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<font><font>\u5f02\u6b65\u5730\uff0c\u5927\u7ea6\u4e8c\u5230\u4e8c\u5341\u79d2\u540e\uff0c\u6211\u4eec\u5c06\u6536\u5230\u7f29\u7565\u56fe\u4ee3\u8868\u7684\u56de\u590d\u3002<\/font><font>\u5728\u5c1d\u8bd5\u5c06\u5b83\u7f29\u5c0f\u4e3aUIImage\u6216NSImage\u4e4b\u524d\uff0c\u68c0\u67e5\u7f29\u7565\u56fe\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u56e0\u4e3a\u7ffb\u8bd1\u53ef\u80fd\u4f1a\u5931\u8d25\u3002<\/font><font>\u5c31\u8fd9\u6837\u3002<\/font><\/font>\n\t<\/li>\n<\/ol>\n<p>\n\t<font><font>\u60a8\u53ef\u80fd\u60f3\u77e5\u9053\u7f29\u7565\u56fe\u5982\u4f55\u51b3\u5b9a\u8fd4\u56de\u54ea\u4e2a\u5e27\u3002<\/font><font>\u8fd9\u57fa\u4e8e\u5f53\u524d\u66f4\u590d\u6742\u7684\u7b97\u6cd5\uff0c\u53d6\u51b3\u4e8e\u5a92\u4f53\u7684\u5173\u952e\u5e27\u7684\u6301\u7eed\u65f6\u95f4\u548c\u53ef\u7528\u6027\u3002<\/font><font>\u672a\u6765\u7248\u672c\u4e5f\u53ef\u80fd\u4f1a\u5206\u6790\u56fe\u50cf\u5185\u5bb9\u3002<\/font><\/font><br \/>\n\t<font><font>\u60a8\u53ef\u4ee5\u4f7f\u7528\u7f29\u7565\u56fe\u7684<\/font><\/font><em><font><font>snapshotPosition<\/font><\/font><\/em><font><font>\u5c5e\u6027\uff08\u8303\u56f4\u4e3a0.0\u52301.0\uff09<\/font><font>\u8986\u76d6\u6b64\u7b97\u6cd5<\/font><font>\u3002<\/font><\/font>\n<\/p>\n<h3>\n\t<font><font>\u5feb\u7167<\/font><\/font><br \/>\n<\/h3>\n<p>\n\t<font><font>VLCMediaPlayer\u7c7b\u5305\u542b\u4e00\u4e2a\u975e\u5e38\u57fa\u672c\u7684API\uff0c\u5b83\u5141\u8bb8\u5728\u64ad\u653e\u8fc7\u7a0b\u4e2d\u521b\u5efa\u65e0\u9650\u6570\u91cf\u7684\u5feb\u7167\uff0c\u8fd9\u4e9b\u5feb\u7167\u5c06\u4ee5\u672c\u5730\u6587\u4ef6\u7684\u5f62\u5f0f\u5f02\u6b65\u5b58\u50a8\u3002<\/font><font>\u5c3a\u5bf8\u53c2\u6570\u9075\u5faa\u4e0e\u7f29\u7565\u56fe\u76f8\u540c\u7684\u6a21\u5f0f\u3002<\/font><\/font>\n<\/p>\n<pre class=\"brush:cpp;\">\r\n- (void)workerMethod\r\n{\r\n    \/\/ ...\r\n    [_mediaplayer saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height];\r\n    \/\/ ...\r\n}<\/pre>\n<p>\n\t<font><font>\u4e00\u65e6\u5feb\u7167\u4fdd\u5b58\uff0c\u4e00\u4e2a<\/font><\/font><em><font><font>VLCMediaPlayerSnapshotTaken<\/font><\/font><\/em><font><font>&nbsp;&nbsp;\u901a\u77e5\u53d1\u51fa\u540e\uff0c<\/font><\/font><em><font><font>mediaPlayerSnapshot<\/font><\/font><font><font>\uff1a<\/font><\/font><\/em><font><font>\u88ab\u79f0\u4e3a\u5a92\u4f53\u64ad\u653e\u5668\u7684\u4ee3\u8868\u3002<\/font><font>\u8bf7\u6ce8\u610f\uff0c\u59d4\u6258\u8c03\u7528\u4ec5\u9002\u7528\u4e8eiOS\u548ctvOS\u3002<\/font><\/font><br \/>\n\t<font><font>\u4f5c\u4e3aiOS\u548ctvOS\u4e0a\u7684VLCKit 3.0\u7684\u4e00\u4e2a\u4fbf\u5229\uff0c\u5a92\u4f53\u64ad\u653e\u5668\u7c7b\u63d0\u4f9b\u4e86<\/font><\/font><em><font><font>lastSnapshot<\/font><\/font><\/em><font><font>&nbsp;&nbsp;\u548c<\/font><\/font><em><font><font>snapshots<\/font><\/font>&nbsp;<\/em><font><font>\u5c5e\u6027\uff0c\u5b83\u4eec\u63d0\u4f9b\u6700\u540e\u4e00\u4e2a\u955c\u5934\u7684UIImage\u5b9e\u4f8b\u4ee5\u53ca\u62cd\u6444\u955c\u5934\u7684\u6587\u4ef6\u5217\u8868\u3002<\/font><\/font>\n<\/p>\n<p>\n\t<font><font>\u8fd9\u5c31\u662f\u4eca\u5929\u3002<\/font><font>\u4eab\u53d7\u4f7f\u7528VLCKit\uff01<\/font><\/font><\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2779\">MobileVLCKit\u548cVLCKit\u5904\u7406\u5feb\u7167\u548c\u7f29\u7565\u56fe<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u89c6\u9891\u5185\u5bb9\u7684\u7f29\u7565\u56fe\u3002\u6211\u4eec\u9700\u8981\u533a\u5206\u4e24\u4e2a\u5173\u952e\u65b9\u9762\uff1a\u4fdd\u5b58\u5f53\u524d\u6b63\u5728\u64ad\u653e\u7684\u89c6\u9891\uff08\u5feb\u7167\uff09\u7684\u9759\u6001\u56fe\u50cf\u548c\u9884\u89c8\u672a\u64ad [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118],"tags":[1636,1186,1637,1185,1013],"class_list":["post-2779","post","type-post","status-publish","format-standard","hentry","category-ndisdevelop","tag-vlc","tag-vlc-web","tag-vlckit","tag-1185","tag-1013"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2779"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2779\/revisions"}],"predecessor-version":[{"id":2780,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2779\/revisions\/2780"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}