GKDYVideoPlayer.h
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// GKDYVideoPlayer.h
// GKDYVideo
//
// Created by QuintGao on 2018/9/23.
// Copyright © 2018 QuintGao. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, GKDYVideoPlayerStatus) {
GKDYVideoPlayerStatusUnload, // 未加载
GKDYVideoPlayerStatusPrepared, // 准备播放
GKDYVideoPlayerStatusLoading, // 加载中
GKDYVideoPlayerStatusPlaying, // 播放中
GKDYVideoPlayerStatusPaused, // 暂停
GKDYVideoPlayerStatusEnded, // 播放完成
GKDYVideoPlayerStatusError // 错误
};
@class GKDYVideoPlayer;
@protocol GKDYVideoPlayerDelegate <NSObject>
- (void)player:(GKDYVideoPlayer *)player statusChanged:(GKDYVideoPlayerStatus)status;
- (void)player:(GKDYVideoPlayer *)player currentTime:(float)currentTime totalTime:(float)totalTime progress:(float)progress;
- (void)startPlay: (UIView *)view url: (NSString *)url;
- (void)pausePlayer;
- (void)resumePlayer;
- (void)stopPlayer;
@end
@interface GKDYVideoPlayer : NSObject
@property (nonatomic, weak) id<GKDYVideoPlayerDelegate> delegate;
@property (nonatomic, assign) GKDYVideoPlayerStatus status;
@property (nonatomic, assign) BOOL isPlaying;
/**
根据指定url在指定视图上播放视频
@param playView 播放视图
@param url 播放地址
*/
- (void)playVideoWith:(UIView *)playView url:(NSString *)url;
/**
停止播放并移除播放视图
*/
- (void)removeVideo;
/**
暂停播放
*/
- (void)pausePlay;
/**
恢复播放
*/
- (void)resumePlay;
/**
重新播放
*/
- (void)resetPlay;
@end
NS_ASSUME_NONNULL_END