Cocoa:来自原始数据的AVAsset(即NSData)

Cocoa:来自原始数据的AVAsset(即NSData),第1张

概述我想使用AVFoundation在osx上显示视频.我想在运行时从原始数据初始化电影.根据这个文件: https://developer.apple.com/library/mac/#technotes/tn2300/_index.html AVAsset相当于QTKit的QTMovie. QTMovie有函数movieWithData:error:从数据加载视频,而我在AVAsset中找不到类似 我想使用AVFoundation在osx上显示视频.我想在运行时从原始数据初始化电影.根据这个文件: https://developer.apple.com/library/mac/#technotes/tn2300/_index.html AVAsset相当于QTKit的QTMovIE. QTMovIE有函数movIEWithData:error:从数据加载视频,而我在AVAsset中找不到类似的东西.那么,有可能在AVFoundation中做同样的事情吗?

谢谢

解决方法
Nsstring *tempfilePath = [NstemporaryDirectory() stringByAppendingPathComponent:@"tmp.mp3"];NSfileManager *manager = [NSfileManager defaultManager];[manager createfileAtPath:tempfilePath contents:mp3Data attributes:nil];AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:tempfilePath] options:nil];dispatch_after(dispatch_time(disPATCH_TIME_Now,(int64_t)(2 * NSEC_PER_SEC)),dispatch_get_main_queue(),^{            [manager removeItemAtPath:tempfilePath error:nil];        });
总结

以上是内存溢出为你收集整理的Cocoa:来自原始数据的AVAsset(即NSData)全部内容,希望文章能够帮你解决Cocoa:来自原始数据的AVAsset(即NSData)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1020437.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存