Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit ca27702

Browse files
committed
Merge pull request #952 from lappp9/ASVideoNode
[ASVideoNode] Basic Video node using AVPlayerLayer.
2 parents 83aaa46 + d955911 commit ca27702

48 files changed

Lines changed: 2636 additions & 21 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@
355355
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */; };
356356
ACF6ED621B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */; };
357357
ACF6ED631B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */; };
358+
AEEC47E11C20C2DD00EC1693 /* ASVideoNode.h in Headers */ = {isa = PBXBuildFile; fileRef = AEEC47DF1C20C2DD00EC1693 /* ASVideoNode.h */; };
359+
AEEC47E21C20C2DD00EC1693 /* ASVideoNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E01C20C2DD00EC1693 /* ASVideoNode.mm */; };
360+
AEEC47E41C21D3D200EC1693 /* ASVideoNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E31C21D3D200EC1693 /* ASVideoNodeTests.m */; };
358361
B0F8805A1BEAEC7500D17647 /* ASTableNode.h in Headers */ = {isa = PBXBuildFile; fileRef = B0F880581BEAEC7500D17647 /* ASTableNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
359362
B0F8805B1BEAEC7500D17647 /* ASTableNode.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F880591BEAEC7500D17647 /* ASTableNode.m */; };
360363
B13CA0F71C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = B13CA0F61C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h */; };
@@ -767,6 +770,9 @@
767770
ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASOverlayLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
768771
ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRatioLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
769772
ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
773+
AEEC47DF1C20C2DD00EC1693 /* ASVideoNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASVideoNode.h; sourceTree = "<group>"; };
774+
AEEC47E01C20C2DD00EC1693 /* ASVideoNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASVideoNode.mm; sourceTree = "<group>"; };
775+
AEEC47E31C21D3D200EC1693 /* ASVideoNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASVideoNodeTests.m; sourceTree = "<group>"; };
770776
B0F880581BEAEC7500D17647 /* ASTableNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTableNode.h; sourceTree = "<group>"; };
771777
B0F880591BEAEC7500D17647 /* ASTableNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTableNode.m; sourceTree = "<group>"; };
772778
B13CA0F61C519E9400E031AB /* ASCollectionViewLayoutFacilitatorProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionViewLayoutFacilitatorProtocol.h; sourceTree = "<group>"; };
@@ -907,6 +913,8 @@
907913
children = (
908914
92DD2FE11BF4B97E0074C9DD /* ASMapNode.h */,
909915
92DD2FE21BF4B97E0074C9DD /* ASMapNode.mm */,
916+
AEEC47DF1C20C2DD00EC1693 /* ASVideoNode.h */,
917+
AEEC47E01C20C2DD00EC1693 /* ASVideoNode.mm */,
910918
055F1A3A19ABD43F004DAFF1 /* ASCellNode.h */,
911919
AC6456071B0A335000CF11B8 /* ASCellNode.m */,
912920
18C2ED7C1B9B7DE800F627B3 /* ASCollectionNode.h */,
@@ -1006,6 +1014,7 @@
10061014
254C6B531BF8FF2A003EC431 /* ASTextKitTests.mm */,
10071015
058D0A36195D057000B7D73C /* ASTextNodeTests.m */,
10081016
058D0A37195D057000B7D73C /* ASTextNodeWordKernerTests.mm */,
1017+
AEEC47E31C21D3D200EC1693 /* ASVideoNodeTests.m */,
10091018
058D09C6195D04C000B7D73C /* Supporting Files */,
10101019
052EE06A1A15A0D8002C6279 /* TestResources */,
10111020
2538B6F21BC5D2A2003CA0B4 /* ASCollectionViewFlowLayoutInspectorTests.m */,
@@ -1306,6 +1315,7 @@
13061315
18C2ED7E1B9B7DE800F627B3 /* ASCollectionNode.h in Headers */,
13071316
257754C01BEE458E00737CA5 /* ASTextNodeWordKerner.h in Headers */,
13081317
AC3C4A511A1139C100143C57 /* ASCollectionView.h in Headers */,
1318+
AEEC47E11C20C2DD00EC1693 /* ASVideoNode.h in Headers */,
13091319
DE8BEAC11C2DF3FC00D57C12 /* ASDelegateProxy.h in Headers */,
13101320
205F0E1D1B373A2C007741D0 /* ASCollectionViewLayoutController.h in Headers */,
13111321
AC3C4A541A113EEC00143C57 /* ASCollectionViewProtocols.h in Headers */,
@@ -1577,6 +1587,8 @@
15771587
058D09B9195D04C000B7D73C /* Frameworks */,
15781588
058D09BA195D04C000B7D73C /* Resources */,
15791589
3B9D88CDF51B429C8409E4B6 /* Copy Pods Resources */,
1590+
527A806066E1F4E2795090DF /* Embed Pods Frameworks */,
1591+
1B86F48711505F91D5FEF571 /* Embed Pods Frameworks */,
15801592
);
15811593
buildRules = (
15821594
);
@@ -1706,6 +1718,21 @@
17061718
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-resources.sh\"\n";
17071719
showEnvVarsInLog = 0;
17081720
};
1721+
527A806066E1F4E2795090DF /* Embed Pods Frameworks */ = {
1722+
isa = PBXShellScriptBuildPhase;
1723+
buildActionMask = 2147483647;
1724+
files = (
1725+
);
1726+
inputPaths = (
1727+
);
1728+
name = "Embed Pods Frameworks";
1729+
outputPaths = (
1730+
);
1731+
runOnlyForDeploymentPostprocessing = 0;
1732+
shellPath = /bin/sh;
1733+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-frameworks.sh\"\n";
1734+
showEnvVarsInLog = 0;
1735+
};
17091736
/* End PBXShellScriptBuildPhase section */
17101737

17111738
/* Begin PBXSourcesBuildPhase section */
@@ -1756,6 +1783,7 @@
17561783
058D0A14195D050800B7D73C /* ASDisplayNode.mm in Sources */,
17571784
DEC146B81C37A16A004A0EE7 /* ASCollectionInternal.m in Sources */,
17581785
058D0A15195D050800B7D73C /* ASDisplayNodeExtras.mm in Sources */,
1786+
AEEC47E21C20C2DD00EC1693 /* ASVideoNode.mm in Sources */,
17591787
0587F9BE1A7309ED00AFF0BA /* ASEditableTextNode.mm in Sources */,
17601788
464052231A3F83C40061C0BA /* ASFlowLayoutController.mm in Sources */,
17611789
257754C41BEE458E00737CA5 /* ASTextNodeWordKerner.m in Sources */,
@@ -1843,6 +1871,7 @@
18431871
05EA6FE71AC0966E00E35788 /* ASSnapshotTestCase.mm in Sources */,
18441872
ACF6ED631B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm in Sources */,
18451873
3C9C128519E616EF00E942A0 /* ASTableViewTests.m in Sources */,
1874+
AEEC47E41C21D3D200EC1693 /* ASVideoNodeTests.m in Sources */,
18461875
254C6B521BF8FE6D003EC431 /* ASTextKitTruncationTests.mm in Sources */,
18471876
058D0A3D195D057000B7D73C /* ASTextKitCoreTextAdditionsTests.m in Sources */,
18481877
058D0A40195D057000B7D73C /* ASTextNodeTests.m in Sources */,

AsyncDisplayKit/ASVideoNode.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
#import <AsyncDisplayKit/AsyncDisplayKit.h>
3+
4+
typedef NS_ENUM(NSUInteger, ASVideoGravity) {
5+
ASVideoGravityResizeAspect,
6+
ASVideoGravityResizeAspectFill,
7+
ASVideoGravityResize
8+
};
9+
10+
@protocol ASVideoNodeDelegate;
11+
12+
@interface ASVideoNode : ASControlNode
13+
@property (atomic, strong, readwrite) AVAsset *asset;
14+
@property (atomic, strong, readonly) AVPlayer *player;
15+
@property (atomic, strong, readonly) AVPlayerItem *currentItem;
16+
17+
// When autoplay is set to true, a video node will play when it has both loaded and entered the "visible" interfaceState.
18+
// If it leaves the visible interfaceState it will pause but will resume once it has returned
19+
@property (nonatomic, assign, readwrite) BOOL shouldAutoplay;
20+
@property (nonatomic, assign, readwrite) BOOL shouldAutorepeat;
21+
22+
@property (atomic) NSString *gravity;
23+
@property (atomic) ASButtonNode *playButton;
24+
25+
@property (atomic, weak, readwrite) id<ASVideoNodeDelegate> delegate;
26+
27+
- (void)play;
28+
- (void)pause;
29+
30+
- (BOOL)isPlaying;
31+
32+
@end
33+
34+
@protocol ASVideoNodeDelegate <NSObject>
35+
@optional
36+
- (void)videoPlaybackDidFinish:(ASVideoNode *)videoNode;
37+
@end
38+

0 commit comments

Comments
 (0)