Giter VIP home page Giter VIP logo

ctvideoplayerview's Introduction

CTVideoPlayerView

Join the chat at https://gitter.im/casatwy/CTVideoPlayerView

after git clone repo, run pod update and then open the CTVideoPlayerView.xcworkspace to play with the demo.

according to issue #43 , "The server needs to send byte-range headers for the library and iOS 10+ to work with streaming protocols.", so if you encounter the same issue, you can consider download the video then play, or add byte-range headers in your server response header.

Features

  • it's an UIView
  • plays local media or streams remote media over HTTP
  • customizable UI and user interaction
  • no size restrictions
  • orientation change support
  • simple API
  • playback time observe, video duration
  • download & native file management
  • support customized cover view when downloading video, All you need to do is create a UIView<CTVideoPlayerDownloadingViewProtocol> and assign it to CTVideoView.downloadingView. check DownloadThenPlayViewController for more detail.
  • support changing to full screen, and exit from full screen
  • support horizontal slide to move to the playing second forward or backward, and vertical slide to change the volume

todo:

  • cache played video which comes from a remote url
  • play youtube
  • play RTSP / RTMP

CocoaPods

pod "CTVideoPlayerView"

Quick Try

1. import header

import <CTVideoPlayerView/CTVideoViewCommonHeader.h>

2. Play

2.1 play with asset

CTVideoView *videoView = [[CTVideoView alloc] init];
videoView.assetToPlay = [AVURLAsset assetWithURL:assetUrl];
[videoView play];

CTVideoView can play any AVAsset directly, but the videoUrlType and actualVideoUrlType will be set to CTVideoViewVideoUrlTypeAsset.

If you do care about the url type of what you are playing, you should see play with URL below.

2.2 play with URL

Set videoUrl to make CTVideoView play with URL, the videoUrlType and actualVideoUrlType will be valued properly, if you don't care about them, just use play with asset above.

in short:

CTVideoView *videoView = [[CTVideoView alloc] init];
videoView.frame = CGRectMake(0,0,100,100);
[self.view addSubview:videoView];

videoView.videoUrl = [NSURL URLWithString:@"http://7xs8ft.com2.z0.glb.qiniucdn.com/rcd_vid_865e1fff817746d29ecc4996f93b7f74"]; // mp4 playable
[videoView play];

long story:

@interface SingleVideoViewController ()

@property (nonatomic, strong) CTVideoView *videoView;

@end

@implementation SingleVideoViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.view addSubview:self.videoView];

	// self.videoView.videoUrl = [NSURL URLWithString:@"http://7xs8ft.com2.z0.glb.qiniucdn.com/rcd_vid_865e1fff817746d29ecc4996f93b7f74"]; // mp4 playable
	// self.videoView.videoUrl = [NSURL URLWithString:@"https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8"]; // m3u8 playable
	self.videoView.videoUrl = [[NSBundle mainBundle] URLForResource:@"a" withExtension:@"mp4"]; // native url playable
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
 	self.videoView.frame = self.view.bounds;
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
	[self.videoView play];
}

- (CTVideoView *)videoView
{
    if (_videoView == nil) {
        _videoView = [[CTVideoView alloc] init];
	}
    return _videoView;
}

@end

More Example

Download Video

set download strategy to CTVideoViewDownloadStrategyDownloadOnlyForeground or CTVideoViewDownloadStrategyDownloadForegroundAndBackground to enable Download

[CTVideoManager sharedInstance].downloadStrategy = CTVideoViewDownloadStrategyDownloadForegroundAndBackground;

// they works the same
[videoView startDownloadTask];
// [[CTVideoManager sharedInstance] startDownloadTaskWithUrl:url];
// [[CTVideoManager sharedInstance] startAllDownloadTask];

if download strategy is CTVideoViewDownloadStrategyNoDownload, the download task won't generate even you make a download call.

[CTVideoManager sharedInstance].downloadStrategy = CTVideoViewDownloadStrategyNoDownload;

[videoView startDownloadTask]; // won't start download task
[[CTVideoManager sharedInstance] startDownloadTaskWithUrl:url]; // won't start download task
[[CTVideoManager sharedInstance] startAllDownloadTask]; // won't start download task

after the video is downloaded, CTVideoPlayerView will remember where the native file is, and which remote url is responds to. You can call refreshUrl to refresh current video view's url, and then play the native video file. If you create a brand new video player view, and set videoUrl to a remote url, video player view will search the native file and replace it automatically.

Download Events

you can set downloadDelegate to video player view for more control.

@protocol CTVideoViewDownloadDelegate <NSObject>

@optional
- (void)videoViewWillStartDownload:(CTVideoView *)videoView;
- (void)videoView:(CTVideoView *)videoView downloadProgress:(CGFloat)progress;
- (void)videoViewDidFinishDownload:(CTVideoView *)videoView;
- (void)videoViewDidFailDownload:(CTVideoView *)videoView;
- (void)videoViewDidPausedDownload:(CTVideoView *)videoView;
- (void)videoViewDidDeletedDownloadTask:(CTVideoView *)videoView;
- (void)videoViewIsWaitingForDownload:(CTVideoView *)videoView;

@end

If you don't have a video player view instance, you can observe notifications in CTVideoViewDefinitions.h to get notice of the download events.

/**
 *  notifications
 */
extern NSString * const kCTVideoManagerWillDownloadVideoNotification;
extern NSString * const kCTVideoManagerDidFinishDownloadVideoNotification;
extern NSString * const kCTVideoManagerDownloadVideoProgressNotification;
extern NSString * const kCTVideoManagerDidFailedDownloadVideoNotification;
extern NSString * const kCTVideoManagerDidPausedDownloadVideoNotification;
extern NSString * const kCTVideoManagerDidDeletedDownloadVideoNotification;

/**
 *  notification userinfo keys
 */
extern NSString * const kCTVideoManagerNotificationUserInfoKeyRemoteUrlList;
extern NSString * const kCTVideoManagerNotificationUserInfoKeyRemoteUrl;
extern NSString * const kCTVideoManagerNotificationUserInfoKeyNativeUrl;
extern NSString * const kCTVideoManagerNotificationUserInfoKeyProgress;

Manage Native Video Files

just use CTVideoDataCenter.

@interface CTVideoDataCenter : NSObject

// create
- (void)insertRecordWithRemoteUrl:(NSURL *)remoteUrl status:(CTVideoRecordStatus)status;

// read
- (NSURL *)nativeUrlWithRemoteUrl:(NSURL *)remoteUrl;
- (NSArray <id<CTPersistanceRecordProtocol>> *)recordListWithStatus:(CTVideoRecordStatus)status;
- (CTVideoRecordStatus)statusOfRemoteUrl:(NSURL *)remoteUrl;
- (id<CTPersistanceRecordProtocol>)recordOfRemoteUrl:(NSURL *)url;

// update
- (void)updateWithRemoteUrl:(NSURL *)remoteUrl nativeUrl:(NSURL *)nativeUrl;
- (void)updateWithRemoteUrl:(NSURL *)remoteUrl nativeUrl:(NSURL *)nativeUrl status:(CTVideoRecordStatus)status;

- (void)updateStatus:(CTVideoRecordStatus)status toRemoteUrl:(NSURL *)remoteUrl;
- (void)updateStatus:(CTVideoRecordStatus)status progress:(CGFloat)progress toRemoteUrl:(NSURL *)remoteUrl;
- (void)updateAllStatus:(CTVideoRecordStatus)status;

- (void)pauseAllRecordWithCompletion:(void(^)(void))completion;
- (void)pauseRecordWithRemoteUrlList:(NSArray *)remoteUrlList completion:(void(^)(void))completion;

- (void)startDownloadAllRecordWithCompletion:(void(^)(void))completion;
- (void)startDownloadRemoteUrlList:(NSArray *)remoteUrlList completion:(void(^)(void))completion;

// delete
- (void)deleteWithRemoteUrl:(NSURL *)remoteUrl;
- (void)deleteAllRecordWithCompletion:(void(^)(NSArray *deletedList))completion;
- (void)deleteAllNotFinishedVideo;

@end

You may want more method in this data center, you can fire an issue to tell me what method you want, or give me a pull request directly.

Observe Time

1. set shouldObservePlayTime to YES, and set timeGapToObserve.

if timeGapToObserve is 1, means 1/100 second.

[videoView setShouldObservePlayTime:YES withTimeGapToObserve:10.0f]; // calls the delegate method `- (void)videoView:didPlayToSecond:` every 0.1s during playing.

2. set timeDelegate

videoView.timeDelegate = self;

3. implement - (void)videoView:didPlayToSecond: in timeDelegate

- (void)videoView:(CTVideoView *)videoView didPlayToSecond:(CGFloat)second
{
	NSLog(@"%f", second);
}

Customize Operation Button

1. set custmized button

videoView.playButton = customizedPlayButton;
videoView.retryButton = customizedRetryButton;

2. set id<CTVideoViewButtonDelegate> and implement methods to layout your button

If you don't do this, the buttons will be layouted as size of CGSizeMake(100, 60), and will be put in center of the video.

use pod "HandyFrame" will make your layout code easy and clean.

#import <HandyFrame/UIView+LayoutMethods.h>

set the button delegate

videoView.buttonDelegate = self;

layout with HandyFrame

- (void)videoView:(CTVideoView *)videoView layoutPlayButton:(UIButton *)playButton
{
    playButton.size = CGSizeMake(100, 60);
	[playButton rightInContainer:5 shouldResize:NO];
   	[playButton bottomInContainer:5 shouldResize:NO];
}

- (void)videoView:(CTVideoView *)videoView layoutRetryButton:(UIButton *)retryButton
{
    retryButton.size = CGSizeMake(100, 60);
	[retryButton rightInContainer:5 shouldResize:NO];
   	[retryButton bottomInContainer:5 shouldResize:NO];
}

play with full screen and exit full screen

    if (self.videoView.isFullScreen) {
        [self.videoView exitFullScreen];
    } else {
        [self.videoView enterFullScreen];
    }

see the demo ChangeToFullScreenViewController

slide to move forward or backward

This function is enabled by default, if you do not want it, just set isSlideFastForwardDisabled to YES

videoView.isSlideFastForwardDisabled = YES;

To show the move indicator, you should set playControlDelegate, and use method below

@protocol CTVideoViewPlayControlDelegate <NSObject>

@optional

- (void)videoViewShowPlayControlIndicator:(CTVideoView *)videoView;
- (void)videoViewHidePlayControlIndicator:(CTVideoView *)videoView;
- (void)videoView:(CTVideoView *)videoView playControlDidMoveToSecond:(CGFloat)second direction:(CTVideoViewPlayControlDirection)direction;

@end

the delegate method - (void)videoViewShowPlayControlIndicator:(CTVideoView *)videoView; tells you that you can show your own customized indicator view.

the delegate method - (void)videoViewHidePlayControlIndicator:(CTVideoView *)videoView; tells you that you can hide your own customized indicator view.

the delegate method - (void)videoView:(CTVideoView *)videoView playControlDidMoveToSecond:(CGFloat)second direction:(CTVideoViewPlayControlDirection)direction; tells you the data that you can use to update the content of your own customized indicator view.

Manual

properties

Regular

isMuted

set video muted

shouldPlayAfterPrepareFinished

if you want to play video immediatly after video is prepared, set this to YES.

if you call play instead of prepare, video will play after prepare finished, even you set this property to NO.

shouldReplayWhenFinish

set to YES will replay the video when the video reaches to the end.

shouldChangeOrientationToFitVideo

set to YES will change video view's orientation automatically for video playing.

Download

shouldDownloadWhenNotWifi

this is a readonly property, if you want to change the value, set bool value of kCTVideoViewShouldDownloadWhenNotWifi in NSUserDefaults to change this value, default is NO

Operation Buttons

shouldShowOperationButton

set to YES to indicate video view should show operation button

playButton

the view of customized play button

retryButton

the view of customized retry button

Time

totalDurationSeconds

to show how long the video is in seconds

shouldObservePlayTime

if you want - (void)videoView:didPlayToSecond: of id<CTVideoViewTimeDelegate> to be called, you should set this property to YES.

currentPlaySpeed

set 2.0 means speed of 2x.

Video Cover View

shouldShowOperationButton

set to YES to indicate video view should show video cover view

coverView

the customized cover view

ctvideoplayerview's People

Contributors

casatwy avatar gitter-badger avatar kirayamato1989 avatar smhjsw avatar wujichao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ctvideoplayerview's Issues

可以考虑支持youtube url

如果作者愿意,可以考虑提供youtube URL支持,现在很多类似的开源项目都不支持youtube url,我现在的实现思路基本上是通过一个第三方的youtube video url parse提取出avplayer 支持的url,然后传递此url给本项目的接口,实现youtube播放功能。具体的方案:https://github.com/0xced/XCDYouTubeKit 。如果能直接支持youtube url, 这样一来这个项目的功能更加强大。仅是一个建议,不妥之处,请见谅。

播放进度条

我想播放的时候有播放进度条,拖动进度条改变视频播放的位置,怎么弄?多谢!

build error

CTVideoPlayerView/CTVideoView/CTVideoView/Components/DownloadManager/CTVideoDownloadManager.m:230:94: Sending 'void (^)(NSProgress * _Nonnull __strong)' to parameter of incompatible type 'NSProgress *__autoreleasing _Nullable * _Nullable'

方法找不到问题

[self.videoTable updateValue:@(CTVideoRecordStatusPaused) forKey:@"status" whereKey:@"remoteUrl" inList:remoteUrlList error:NULL];

return [self.videoTable findAllWithKeyName:@"status" value:@(status) error:NULL];

Missing Method

In class CTVideoDataCenter.m

  • (void)startDownloadRemoteUrlList:(NSArray *)remoteUrlList completion:(void (^)(void))completion
    {
    [self.videoTable updateValue:@(CTVideoRecordStatusWaitingForDownload) forKey:@"status" whereKey:@"remoteUrl" inList:remoteUrlList error:NULL];
    if (completion) {
    completion();
    }
    }
  • (void)pauseRecordWithRemoteUrlList:(NSArray *)remoteUrlList completion:(void (^)(void))completion
    {
    [self.videoTable updateValue:@(CTVideoRecordStatusPaused) forKey:@"status" whereKey:@"remoteUrl" inList:remoteUrlList error:NULL];
    if (completion) {
    completion();
    }
    }

There is no this method : updateValue: forKey: whereKey: inList: error:

  • (NSArray<id> *)recordListWithStatus:(CTVideoRecordStatus)status
    {
    return [self.videoTable findAllWithKeyName:@"status" value:@(status) error:NULL];
    }

There is no this method : findAllWithKeyName: value: error:

'Cannot remove an observer ... for the key path "player.currentItem.status"

I'm getting the following error when closing the viewController containing the Player:

Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <CTVideoView 0x15f35dec0> for the key path "player.currentItem.status" from <CTVideoView 0x15f35dec0> because it is not registered as an observer.

The code I am using is as follows:

let videoUrlString = campaign.contentUrl?.stringByReplacingOccurrencesOfString("mpd", withString: "mp4")
let videoURL = NSURL(string: videoUrlString!)
player = CTVideoView(frame: CGRectMake(0, 0, viewContent.frame.width, viewContent.frame.height))
viewContent.addSubview(player)
player.assetToPlay = AVURLAsset(URL: videoURL!)
player.play()

import not working correctly with cocoapods

Tried to make a project with cocoapod

Seems thzat CTVideoViewCommonHeader.h is not in thep od

Here is the .h header
#import <UIKit/UIKit.h>
#import "CTVideoView.h"
!! <CTVideoPlayerView/CTVideoViewCommonHeader.h> is not in the pod !
In the objectivec

@Property (nonatomic) CTVideoView *videoView ;

self.videoView = [[CTVideoView alloc] init];

self.videoView.frame = self.view.frame ; // CGRectMake(0,0,100,100);
[self.view addSubview:self.videoView];

self.videoView.videoUrl = [NSURL URLWithString:kURLTest1 ]; // mp4 playable → property videoUrl not fonud on object of type ' CTvideoView *'
[self.videoView play]; → no visible @interface for 'CtvideoPBView' declares the selector 'play'

加载进度

请问大神,我怎样知道视频已经加载了多少?

CTVideoManager中的downloadWithUrl方法并没能保存文件到本地

在CTVideoManager.m文件中的downloadWithUrl:方法

- (void)downloadWithUrl:(NSURL *)url
{
    if (self.downloadStrategy == CTVideoViewDownloadStrategyNoDownload) {
        return;
    }

    NSURL *nativeUrl = [self.dataCenter nativeUrlWithRemoteUrl:url];
    if (nativeUrl == nil) {
        NSString *fileName = [NSString stringWithFormat:@"%@.mp4", [NSUUID UUID].UUIDString];
        //nativeUrl使用有误:
        nativeUrl = [NSURL URLWithString:[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:fileName]];
    }
    [self.dataCenter updateWithRemoteUrl:url nativeUrl:nativeUrl status:CTVideoRecordStatusWaitingForDownload];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    ........

这里的nativeUrl使用了[NSURL URLWithString:]方法获取,会导致下载的临时文件无法正确地移动到nativeUrl的对应地址,应使用[NSURL fileURLWithPath:]方法吧。。。

More videos in a single view raises error -11839 "Cannot Decode"

I added several CTVideoViews in a single view controller.
After about 16 CTVideoViews (on iPhone 7 with iOS 11.2.5) I got the following error:

Error Domain=AVFoundationErrorDomain Code=-11839 "Cannot Decode" UserInfo={NSLocalizedDescription=Cannot Decode, NSUnderlyingError=0x1c1859fb0 {Error Domain=NSOSStatusErrorDomain Code=-12913 "(null)"}, NSLocalizedRecoverySuggestion=Stop any other actions that decode media and try again., NSLocalizedFailureReason=The decoder required for this media is busy.}

Any suggestions?

崩溃

hi, crashlytics上收集到这样的崩溃,如果方便可以看看~谢谢

Crashlytics - plaintext stacktrace downloaded by menamobile at Fri, 10 Mar 2017 10:29:17 GMT

URL: https://fabric.io/menamobile/ios/apps/com.menamobile.menamuper/issues/58c23a950aeb16625b365f6b?time=last-seven-days/sessions/e88bef339d34428bb34dbbea812e3f13_5eb0017d53884f708985f2c602b3b59a_0_v1

Organization: menamobile

Platform: ios

Application: Muper

Version: N/A

Bundle Identifier: com.Menamobile.MenaMuper

Issue #: 90

Issue ID: 58c23a950aeb16625b365f6b

Session ID: e88bef339d34428bb34dbbea812e3f13_5eb0017d53884f708985f2c602b3b59a_0_v1

Date: 2017-03-10T05:33:37Z

OS Version: 10.2.1 (14D27)

Device: iPhone 7 Plus

RAM Free: 18.2%

Disk Free: 58.9%

#0. Crashed: com.apple.main-thread
0 libsystem_c.dylib 0x180fbd75c __sfvwrite + 158
1 libsystem_c.dylib 0x180fc512c __vfprintf + 11836
2 libsystem_c.dylib 0x180fdfb0c __v2printf + 388
3 libsystem_c.dylib 0x180f7215c _vsnprintf + 284
4 libsystem_c.dylib 0x180f72b80 snprintf_l + 28
5 CoreFoundation 0x1820532fc __CFStringAppendFormatCore + 12284
6 CoreFoundation 0x1820502c8 _CFStringCreateWithFormatAndArgumentsAux2 + 244
7 Foundation 0x182abe918 -[NSString initWithFormat:] + 40
8 AVFoundation 0x1898a7c28 -[AVRetainReleaseWeakReference initWithReferencedObject:] + 136
9 AVFoundation 0x1898a81f4 -[AVCallbackContextRegistry registerCallbackContextObject:] + 68
10 AVFoundation 0x1898a8f78 -[AVCMNotificationDispatcher addListenerWithWeakReference:callback:name:object:flags:] + 124
11 AVFoundation 0x189814450 -[AVTimebaseObserver _startObservingTimebaseNotifications] + 152
12 AVFoundation 0x18981429c -[AVTimebaseObserver _finishInitialization] + 36
13 AVFoundation 0x18981472c -[AVPeriodicTimebaseObserver initWithTimebase:interval:queue:block:] + 332
14 AVFoundation 0x1897d96a8 -[AVPlayer addPeriodicTimeObserverForInterval:queue:usingBlock:] + 152
15 CTVideoPlayerView 0x101bbe34c -[CTVideoView(TimePrivate) addVideoStartTimeObserver] (CTVideoView+Time.m:52)
16 CTVideoPlayerView 0x101bbfd14 -[CTVideoView play] (CTVideoView.m:189)
17 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
18 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
19 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
20 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
21 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
22 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
23 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
24 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
25 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
26 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
27 MenaMuper 0x10050bb98 MNPostContentCell.MediaContentCanvaseView.resumePlay() -> () (MNPostContentCell+Canvas.swift:141)
28 MenaMuper 0x1007fbf04 MNPostContentCell.resumePlay() -> () (MNPostContentCell.swift:148)
29 MenaMuper 0x1003c1870 MNPlayVideoViewController.playVideo() -> () (MNPlayVideoViewController.swift:185)
30 MenaMuper 0x1003c21ac @objc MNPlayVideoViewController.playVideo() -> () (MNPlayVideoViewController.swift)
31 MenaMuper 0x1003bfaa4 MNPlayVideoViewController.(collectionView(UICollectionView, willDisplayCell : UICollectionViewCell, forItemAtIndexPath : NSIndexPath) -> ()).(closure #1) (MNPlayVideoViewController.swift:66)
32 MenaMuper 0x1001caee4 thunk (UIImageView+Kingfisher.swift)
33 libdispatch.dylib 0x180f1a1fc _dispatch_call_block_and_release + 24
34 libdispatch.dylib 0x180f1a1bc _dispatch_client_callout + 16
35 libdispatch.dylib 0x180f1ed68 _dispatch_main_queue_callback_4CF + 1000
36 CoreFoundation 0x18203e810 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
37 CoreFoundation 0x18203c3fc __CFRunLoopRun + 1660
38 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
39 GraphicsServices 0x183a1e198 GSEventRunModal + 180
40 UIKit 0x187fb17fc -[UIApplication _run] + 684
41 UIKit 0x187fac534 UIApplicationMain + 208
42 MenaMuper 0x1007e5660 main (AppDelegate.swift:22)
43 libdispatch.dylib 0x180f4d5b8 (Missing)

--

#0. Crashed: com.apple.main-thread
0 libsystem_c.dylib 0x180fbd75c __sfvwrite + 158
1 libsystem_c.dylib 0x180fc512c __vfprintf + 11836
2 libsystem_c.dylib 0x180fdfb0c __v2printf + 388
3 libsystem_c.dylib 0x180f7215c _vsnprintf + 284
4 libsystem_c.dylib 0x180f72b80 snprintf_l + 28
5 CoreFoundation 0x1820532fc __CFStringAppendFormatCore + 12284
6 CoreFoundation 0x1820502c8 _CFStringCreateWithFormatAndArgumentsAux2 + 244
7 Foundation 0x182abe918 -[NSString initWithFormat:] + 40
8 AVFoundation 0x1898a7c28 -[AVRetainReleaseWeakReference initWithReferencedObject:] + 136
9 AVFoundation 0x1898a81f4 -[AVCallbackContextRegistry registerCallbackContextObject:] + 68
10 AVFoundation 0x1898a8f78 -[AVCMNotificationDispatcher addListenerWithWeakReference:callback:name:object:flags:] + 124
11 AVFoundation 0x189814450 -[AVTimebaseObserver _startObservingTimebaseNotifications] + 152
12 AVFoundation 0x18981429c -[AVTimebaseObserver _finishInitialization] + 36
13 AVFoundation 0x18981472c -[AVPeriodicTimebaseObserver initWithTimebase:interval:queue:block:] + 332
14 AVFoundation 0x1897d96a8 -[AVPlayer addPeriodicTimeObserverForInterval:queue:usingBlock:] + 152
15 CTVideoPlayerView 0x101bbe34c -[CTVideoView(TimePrivate) addVideoStartTimeObserver] (CTVideoView+Time.m:52)
16 CTVideoPlayerView 0x101bbfd14 -[CTVideoView play] (CTVideoView.m:189)
17 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
18 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
19 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
20 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
21 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
22 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
23 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
24 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
25 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
26 CTVideoPlayerView 0x101bc000c -[CTVideoView replay] (CTVideoView.m:224)
27 MenaMuper 0x10050bb98 MNPostContentCell.MediaContentCanvaseView.resumePlay() -> () (MNPostContentCell+Canvas.swift:141)
28 MenaMuper 0x1007fbf04 MNPostContentCell.resumePlay() -> () (MNPostContentCell.swift:148)
29 MenaMuper 0x1003c1870 MNPlayVideoViewController.playVideo() -> () (MNPlayVideoViewController.swift:185)
30 MenaMuper 0x1003c21ac @objc MNPlayVideoViewController.playVideo() -> () (MNPlayVideoViewController.swift)
31 MenaMuper 0x1003bfaa4 MNPlayVideoViewController.(collectionView(UICollectionView, willDisplayCell : UICollectionViewCell, forItemAtIndexPath : NSIndexPath) -> ()).(closure #1) (MNPlayVideoViewController.swift:66)
32 MenaMuper 0x1001caee4 thunk (UIImageView+Kingfisher.swift)
33 libdispatch.dylib 0x180f1a1fc _dispatch_call_block_and_release + 24
34 libdispatch.dylib 0x180f1a1bc _dispatch_client_callout + 16
35 libdispatch.dylib 0x180f1ed68 _dispatch_main_queue_callback_4CF + 1000
36 CoreFoundation 0x18203e810 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
37 CoreFoundation 0x18203c3fc __CFRunLoopRun + 1660
38 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
39 GraphicsServices 0x183a1e198 GSEventRunModal + 180
40 UIKit 0x187fb17fc -[UIApplication _run] + 684
41 UIKit 0x187fac534 UIApplicationMain + 208
42 MenaMuper 0x1007e5660 main (AppDelegate.swift:22)
43 libdispatch.dylib 0x180f4d5b8 (Missing)

#1. com.talkingdata.sdk.queue
0 libsystem_kernel.dylib 0x181041188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x181040ff8 mach_msg + 72
2 CaptiveNetwork 0x18ad3121c CopyCurrentNetworkInfo + 220
3 CaptiveNetwork 0x18ad30640 __CNCopyCurrentNetworkInfo + 108
4 MenaMuper 0x1011f9e58 +[TDAACNetworkInfo getRouterInfo:] + 5904300
5 MenaMuper 0x1011cf064 +[TDAAPacketManager getWifiAPProfile:] + 5728696
6 MenaMuper 0x1011cee08 +[TDAAPacketManager getNetworkProfiles:] + 5728092
7 MenaMuper 0x1011cd8e4 +[TDAAPacketManager getEventWithAction:config:] + 5722680
8 MenaMuper 0x1011c902c __47-[TDAASDKManager storeMessageDomain:name:data:]_block_invoke + 5704064
9 libdispatch.dylib 0x180f1a1fc _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x180f1a1bc _dispatch_client_callout + 16
11 libdispatch.dylib 0x180f283dc _dispatch_queue_serial_drain + 928
12 libdispatch.dylib 0x180f1d9a4 _dispatch_queue_invoke + 652
13 libdispatch.dylib 0x180f2a34c _dispatch_root_queue_drain + 572
14 libdispatch.dylib 0x180f2a0ac _dispatch_worker_thread3 + 124
15 libsystem_pthread.dylib 0x1811232a0 _pthread_wqthread + 1288
16 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#2. com.apple.root.user-initiated-qos.overcommit
0 libsystem_kernel.dylib 0x181041290 syscall_thread_switch + 8
1 libdispatch.dylib 0x180f2a688 _dispatch_root_queue_drain_one_slow + 100
2 libdispatch.dylib 0x180f2a1d8 _dispatch_root_queue_drain + 200
3 libdispatch.dylib 0x180f2a0ac _dispatch_worker_thread3 + 124
4 libsystem_pthread.dylib 0x1811232a0 _pthread_wqthread + 1288
5 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#3. com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x181041188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x181040ff8 mach_msg + 72
2 CoreFoundation 0x18203e5d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x18203c1ec __CFRunLoopRun + 1132
4 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
5 Foundation 0x182aa726c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x182ac7dd0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7 UIKit 0x188925c38 -[UIEventFetcher threadMain] + 136
8 Foundation 0x182ba4e68 NSThread__start + 1024
9 libsystem_pthread.dylib 0x181125850 + 240
10 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
11 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#4. com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x181041188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x181040ff8 mach_msg + 72
2 CoreFoundation 0x18203e5d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x18203c1ec __CFRunLoopRun + 1132
4 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
5 CFNetwork 0x18276fa70 + 336
6 Foundation 0x182ba4e68 NSThread__start + 1024
7 libsystem_pthread.dylib 0x181125850 + 240
8 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
9 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#5. com.twitter.crashlytics.ios.MachExceptionServer
0 MenaMuper 0x10102a500 CLSProcessRecordAllThreads + 4005460
1 MenaMuper 0x10102a500 CLSProcessRecordAllThreads + 4005460
2 MenaMuper 0x10102a3bc CLSProcessRecordAllThreads + 4005136
3 MenaMuper 0x10101ab7c CLSHandler + 3941584
4 MenaMuper 0x101015b20 CLSMachExceptionServer + 3921012
5 libsystem_pthread.dylib 0x181125850 + 240
6 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
7 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#6. Thread
0 libsystem_kernel.dylib 0x18105fa88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x181123160 _pthread_wqthread + 968
2 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#7. Thread
0 libsystem_kernel.dylib 0x18105fa88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x181123344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#8. com.apple.CoreMotion.MotionThread
0 libsystem_kernel.dylib 0x181041188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x181040ff8 mach_msg + 72
2 CoreFoundation 0x18203e5d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x18203c1ec __CFRunLoopRun + 1132
4 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
5 CoreFoundation 0x181fb7b44 CFRunLoopRun + 112
6 CoreMotion 0x188e2d120 (null) + 203196
7 libsystem_pthread.dylib 0x181125850 + 240
8 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
9 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#9. com.twitter.crashlytics.ios.binary-images
0 libsystem_kernel.dylib 0x181042c14 write + 8
1 MenaMuper 0x101028fac __CLSFileWriteWithRetries_block_invoke + 4000000
2 MenaMuper 0x101028eec CLSFileLoopWithWriteBlock + 3999808
3 MenaMuper 0x10102919c CLSFileWriteToFileDescriptorOrBuffer + 4000496
4 MenaMuper 0x101029470 CLSFileWriteCollectionStart + 4001220
5 MenaMuper 0x101029374 CLSFileWriteSectionStart + 4000968
6 MenaMuper 0x101012240 __CLSBinaryImageChanged_block_invoke + 3906452
7 libdispatch.dylib 0x180f1a1fc _dispatch_call_block_and_release + 24
8 libdispatch.dylib 0x180f1a1bc _dispatch_client_callout + 16
9 libdispatch.dylib 0x180f283dc _dispatch_queue_serial_drain + 928
10 libdispatch.dylib 0x180f1d9a4 _dispatch_queue_invoke + 652
11 libdispatch.dylib 0x180f2a34c _dispatch_root_queue_drain + 572
12 libdispatch.dylib 0x180f2a0ac _dispatch_worker_thread3 + 124
13 libsystem_pthread.dylib 0x1811232a0 _pthread_wqthread + 1288
14 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#10. com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x18105f23c __select + 8
1 CoreFoundation 0x182045468 __CFSocketManager + 640
2 libsystem_pthread.dylib 0x181125850 + 240
3 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
4 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#11. AVAudioSession Notify Thread
0 libsystem_kernel.dylib 0x181041188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x181040ff8 mach_msg + 72
2 CoreFoundation 0x18203e5d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x18203c1ec __CFRunLoopRun + 1132
4 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
5 AVFAudio 0x19ba6fd24 GenericRunLoopThread::Entry(void*) + 164
6 AVFAudio 0x19ba95d9c CAPThread::Entry(CAPThread*) + 84
7 libsystem_pthread.dylib 0x181125850 + 240
8 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
9 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#12. EMGCDAsyncSocket-CFStream
0 libsystem_kernel.dylib 0x181041188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x181040ff8 mach_msg + 72
2 CoreFoundation 0x18203e5d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x18203c1ec __CFRunLoopRun + 1132
4 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
5 Foundation 0x182aa726c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 MenaMuper 0x100b26f54 +[EMGCDAsyncSocket cfstreamThread] (GCDAsyncSocket.m:6902)
7 Foundation 0x182ba4e68 NSThread__start + 1024
8 libsystem_pthread.dylib 0x181125850 + 240
9 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
10 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#13. com.ibireme.webimage.request
0 libsystem_kernel.dylib 0x181041188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x181040ff8 mach_msg + 72
2 CoreFoundation 0x18203e5d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x18203c1ec __CFRunLoopRun + 1132
4 CoreFoundation 0x181f6a2b8 CFRunLoopRunSpecific + 444
5 Foundation 0x182aa726c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x182afbaa0 -[NSRunLoop(NSRunLoop) run] + 88
7 YYWebImage 0x10237d070 +[YYWebImageOperation _networkThreadMain:] (YYWebImageOperation.m:197)
8 Foundation 0x182ba4e68 NSThread__start + 1024
9 libsystem_pthread.dylib 0x181125850 + 240
10 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
11 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#14. Thread
0 libsystem_kernel.dylib 0x18105fa88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x181123160 _pthread_wqthread + 968
2 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#15. Thread
0 libsystem_kernel.dylib 0x1810411dc semaphore_timedwait_trap + 8
1 libdispatch.dylib 0x180f2c770 _dispatch_semaphore_wait_slow + 112
2 libdispatch.dylib 0x180f2b808 _dispatch_worker_thread + 268
3 libsystem_pthread.dylib 0x181125850 + 240
4 libsystem_pthread.dylib 0x181125760 _pthread_start + 282
5 libsystem_pthread.dylib 0x181122d94 thread_start + 4

#16. Thread
0 libsystem_kernel.dylib 0x18105fa88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x181123344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#17. Thread
0 libsystem_kernel.dylib 0x18105fa88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x181123344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#18. Thread
0 libsystem_kernel.dylib 0x18105fa88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x181123344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

#19. Thread
0 libsystem_kernel.dylib 0x18105fa88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x181123344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x181122d8c start_wqthread + 4

youtube

how i can play youtube link and preload them

Error after compile library with cocoa pods

Hi, im having an error while compile the library in some spots of code:

Sending 'void (^)(NSProgress * _Nonnull __strong)' to parameter of incompatible type 'NSProgress *__autoreleasing *' at CTVideoViewDownloadManager at method resumeDownloadWithUrl

Sending 'void (^)(NSProgress * _Nonnull __strong)' to parameter of incompatible type 'NSProgress *__autoreleasing *' at CTVideoViewDownloadManager at method downloadWithUrl

How can i solve it?

Thank you.

出错回调

能不能提供一个播放出错的回调,比如超时

Full screen landscape

Hi there,

Thank you for making this - it's great :)

Is there a way to make a video go fullscreen landscape even while the phone is still in portrait?

Even if I transform the video and then use enterFullscreen(), it rotates the video back and makes it just across the middle of the screen (when in portrait).

git clone 下来运行错误

PhaseScriptExecution 📦\ Check\ Pods\ Manifest.lock /Users/ios/Library/Developer/Xcode/DerivedData/CTVideoView-gwmiwslchfcwozageloqcjhgajdy/Build/Intermediates/CTVideoView.build/Debug-iphonesimulator/CTVideoView.build/Script-C7F799C8385037A3FAE95CAE.sh
cd /Users/ios/Desktop/CTVideoPlayerView
/bin/sh -c /Users/ios/Library/Developer/Xcode/DerivedData/CTVideoView-gwmiwslchfcwozageloqcjhgajdy/Build/Intermediates/CTVideoView.build/Debug-iphonesimulator/CTVideoView.build/Script-C7F799C8385037A3FAE95CAE.sh

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
不知道是什么问题,缺少文件么?

cocoaPods 搜索不到1.3.1

刚刚搜索打算升级一下,但是新版本搜索不到。麻烦大神处理一下。
如下:
-> CTVideoPlayerView (1.3.0)
A video view for iOS which can play multy video at the same time, and can
download and manage video file.
pod 'CTVideoPlayerView', '~> 1.3.0'

could not play the media file with MPEG-4

I download a video file with url and store in local path,when I play it with CTVideoPlayerView,the log output:
Error Domain=AVFoundationErrorDomain Code=-11833 "无法解码" UserInfo={NSLocalizedFailureReason=找不到此媒体所需的解码器。, NSUnderlyingError=0x7fcc90e41f40 {Error Domain=NSOSStatusErrorDomain Code=-12945 "(null)"}, AVErrorMediaTypeKey=soun, NSLocalizedDescription=无法解码}

Doesn't compile with latest version of HandyFrame

I added CTVideoPlayer to my pod file and I typed pod update
pod update installed HandyFrame too
When I compile my project I got several syntax error due to properties that in HandyFrame has different name.
For example
CGFloat centerX = self.playButton.centerX;
gives syntax error because the correct name is ct_centerX instead of centerX

Can you update against the latest version of HandyFrame?

退出时有崩溃

感谢作者提供如此给力的开源项目。自从上次升级以后,截止当前版本,播放器销毁时有崩溃。具体log如下:observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x61000003f940> (
<NSKeyValueObservance 0x610000051970: Observer: 0x7fba66e10510, Key path: player.currentItem.status, Options: <New: YES, Old: NO, Prior: NO> Context: 0x105fd6388, Property: 0x608000092890>
<NSKeyValueObservance 0x610000051c70: Observer: 0x7fba66e10510, Key path: player.currentItem.duration, Options: <New: YES, Old: NO, Prior: NO> Context: 0x105fd6388, Property: 0x6100000954a0>
<NSKeyValueObservance 0x6100000521b0: Observer: 0x7fba66e10510, Key path: layer.readyForDisplay, Options: <New: YES, Old: NO, Prior: NO> Context: 0x105fd6388, Property: 0x610000095b80>

应该是observer没有正确移除导致。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.