草庐IT

avcodec_decode_video

全部标签

regex - Dart : How to extract youtube video ID from video URL?

如何使用dart正则表达式从视频URL中提取YouTube视频ID?示例网址https://www.youtube.com/watch?v=SEkUienM2oY&t=1265s或https://m.youtube.com/watch?v=SEkUienM2oY&t=1265s返回SEkUienM2oY&t=1265s对我有用StringgetVideoID(Stringurl){url=url.replaceAll("https://www.youtube.com/watch?v=","");url=url.replaceAll("https://m.youtube.com/watc

dart - json.decode 在 json 中的嵌套双引号上抛出 FormatException - dart

下面的代码片段在Flutterjson解码中抛出格式异常,有什么建议吗?import'dart:async'showFuture;import'dart:convert';FuturereadBooks()async{StringjsonString='{"description":"Aspartofthe"YouDon’tKnowJS"series","quantity":55}';Mapbooks=json.decode(jsonString);returnjsonString;}格式异常:2018-10-2320:40:30.68018115-18142/addon.com.bo

dart - json.decode 之后的空检查

有没有办法快速检查解码的JSON对象中的空条目?例如:finalresponseJson=json.decode(response.body);这将返回以下内容:responseJson['result']['mydata']['account']='JoeDoe';为了检查“mydata”部分是否不为空,我必须执行以下操作:if(responseJson!=null){if(responseJson['result']!=null){if(responseJson['result']['mydata']!=null)...这真的很丑。如何这样做:if((responseJson!=n

iOS : How to convert a video PHAsset to NSData

我想将我iPhone上存储的视频放到我的Google云端硬盘中。我已经处理了图像,但是对于视频,这是另一个问题......对于图像,没问题,我使用这种方法将我的Assets转换为NSData:data=UIImagePNGRepresentation(result!)!然后我将图像放入我的驱动器!但是,对于视频,我尝试了很多不同的方法,但不行,我不能。我该怎么做?非常感谢! 最佳答案 我做到了!这是解决方案:PHCachingImageManager().requestAVAssetForVideo(asset,options:ni

ios - swift : Play Video in Landscape Mode When Fullscreen

我有这段代码:importUIKitimportMediaPlayerclassViewController:UIViewController{varmoviePlayer:MPMoviePlayerController!varbounds:CGRect=UIScreen.mainScreen().boundsoverridefuncviewDidLoad(){super.viewDidLoad()//Doanyadditionalsetupafterloadingtheview,typicallyfromanib.varwidth:CGFloat=bounds.size.widthv

ios - Swift 3 : How to add watermark on video ? AVVideoCompositionCoreAnimationTool iOS 10 问题

此代码用于在iOS9上为视频添加水印和文本,但自iOS10以来它不再起作用。有一个iOS10bug已提交,但Apple没有答复。我无法实现任何解决方法来在视频上添加水印和文本。使用此代码有时视频会成功导出,但大多数时候不会导出。我应该如何使用AVVideoCompositionCoreAnimationTool才能像在iOS9上那样工作。letvideoComposition:AVMutableVideoComposition=AVMutableVideoComposition()videoComposition.frameDuration=CMTimeMake(1,60)videoC

swift - 不符合 Decodable/Codable 协议(protocol)

我正在使用以下结构:structItem:Codable{varcategory:StringvarbirthDate:Datevarswitch:BoolvarweightNew:[Weight]varweightOld:ArrayvarcreatedAt:DatevaritemIdentifier:UUIDvarcompleted:BoolfuncsaveItem(){DataManager.save(self,with:itemIdentifier.uuidString)}funcdeleteItem(){DataManager.delete(itemIdentifier.uui

swift - 使用 Decodable 进行 JSON 解析时,optional 和 decodeIfPresent 有什么区别?

我第一次使用Swift4的Codable协议(protocol),我无法理解Decodable的decodeIfPresent的使用。///Decodesavalueofthegiventypeforthegivenkey,ifpresent.//////Thismethodreturns`nil`ifthecontainerdoesnothaveavalueassociatedwith`key`,orifthevalueisnull.Thedifferencebetweenthesestatescanbedistinguishedwitha`contains(_:)`call.///

swift - Codable 类不符合 Decodable 协议(protocol)

为什么我会收到“类型‘书签’不符合‘可解码’协议(protocol)”错误消息?classBookmark:Codable{weakvarpublication:Publication?varindexPath:[Int]varlocationInText=0enumCodingKeys:String,CodingKey{caseindexPathcaselocationInText}init(publication:Publication?,indexPath:[Int]){self.publication=publicationself.indexPath=indexPath}}我

swift - 在带有继承的 Swift 4 中使用 Decodable

类继承的使用是否会破坏类的可解码性。比如下面的代码classServer:Codable{varid:Int?}classDevelopment:Server{varname:String?varuserId:Int?}varjson="{\"id\":1,\"name\":\"LargeBuildingDevelopment\"}"letjsonDecoder=JSONDecoder()letitem=tryjsonDecoder.decode(Development.self,from:json.data(using:.utf8)!)asDevelopmentprint(item.