登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

类似YouTube和脸谱网自定义视频效果

[复制链接]
来自: liujh 分类: iOS精品源码 上传时间: 2017-8-28 10:24:00
Tag:

项目介绍:

MMPlayerLayer

ex. use when change player view frequently like tableView / collectionView
import MMPlayerView
mmPlayerLayer.playView = cell.imgView
mmPlayerLayer.set(url: cell.data?.play_Url, state: { (status) in 
})

MMPlayerView

let url = URL.init(string: "http://www.html5videoplayer.net/videos/toystory.mp4")!
playView.replace(cover: CoverA.instantiateFromNib())
playView.set(url: url, thumbImage: #imageLiteral(resourceName: "seven")) { (status) in

switch status {
   case ....
}

}
Transition

PresentedViewController

  1. Set transition config
    required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)

    self.mmPlayerTransition.present.pass { (config) in
        // setting
        .....
    }

    }

  2. Set MMPLayerToProtocol on PresentedViewController

  3. Set MMPlayerPrsentFromProtocol on PresentingViewController
    Shrink

  4. only set present transition can use shrink video
    (self.presentationController as? PassViewPresentatinController)?.shrinkView()

Landscape

1.Set AppDelegate
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) ->

UIInterfaceOrientationMask {
if window == MMLandscapeWindow.shared {
    return .allButUpsideDown
} else {
    return ....
}

}

  1. Observer orientation when landscape call function

    MMLandscapeWindow.shared.makeKey(root: full, playLayer: self.mmPlayerLayer, completed: {
    })

    Cover View

landscape

add cover item view on player

play.replace(cover: CoverA.instantiateFromNib())
Parameter

 public enum CoverViewFitType {
    case fitToPlayerView // coverview fit with playerview
    case fitToVideoRect // fit with VideoRect
 }
 
 public enum ProgressType {
    case `default`
    case none
    case custom(view: ProgressProtocol)
}
        
public var progressType: MMPlayerView.ProgressType  
public var coverFitType: MMPlayerView.CoverViewFitType
public var changeViewClearPlayer: Bool // rest url when change view 
public var hideCoverDuration: TimeInterval // auto hide cover view after duration
lazy public var thumbImageView: UIImageView 
public var playView: UIView?
public var coverView: UIView? { get }
public var autoLoadUrl: Bool // when call set(url:,state) to auto fecth video
public var autoPlay: Bool // when MMPlayerView.PlayViewPlayStatus == ready auto play video
public var currentPlayStatus: MMPlayerView.PlayViewPlayStatus 
public var cacheInMemory: Bool // its AVPlayerItem cache in memory
public var asset: AVURLAsset?
public var playUrl: URL?
public func setCoverView(enable: Bool)
public func delayHideCover()
public func replace<T: UIView>(cover:T) where T: CoverViewProtocol
public func set(url: URL?, state: ((MMPlayerView.PlayViewPlayStatus) -> Swift.Void)?)
public func startLoading() // if autoLoadUrl = false your need call startLoading() yourself 

相关源码推荐:

我来说两句
*滑动验证:
所有评论(56)
逆鳞九霄 2017-8-28 10:44:48
楼主用心了,内容非常精彩。
回复
hellokenken 2017-8-28 10:44:58
不错不错,楼主辛苦了。。。
回复
kengsir 2017-8-28 10:45:20
写的真的很不错
回复
AlonMessi 2017-8-28 10:46:34
code4app好的代码demo真的很多,谢谢啦~
回复
BlueManlove 2017-8-28 10:47:08
感谢分享,楼主V5~
回复
littleRed 2017-8-28 10:47:22
感谢分享,楼主V5~
回复
phoiu 2017-8-28 10:50:17
好好 学习了 确实不错
回复
zxfzxf 2017-8-28 10:50:52
楼主威武啊,Code4App有你更给力!
回复
code4app热心网友 2017-8-28 10:51:02
感谢分享,Code4App有你更精彩:)
回复
提取码:  下载次数:96 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
771 1 96
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

代码贡献英雄榜
用户名 下载数
通过邮件订阅最新 Code4App 信息
上一条 /4 下一条
联系我们
关闭
合作电话:
13802416937
Email:
435399051@qq.com
商务市场合作/投稿
问题反馈及帮助
联系我们

广告投放| Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

快速回复 返回顶部 返回列表