@@ -9,10 +9,17 @@ It is a lite library to render 360 degree panorama video for iOS.
99
1010## Pod
1111```
12- pod 'MD360Player4iOS', '~> 0.2 .0'
12+ pod 'MD360Player4iOS', '~> 0.3 .0'
1313```
1414
1515## Release Node
16+ ** 0.3.0**
17+ * Fix crucial bug(e.g. crash, black screen).
18+ * Custom director factory support.
19+ * Better way to render multi screen.
20+ * Add motion with touch strategy.
21+ * Add 360 bitmap support.
22+
1623** 0.2.0**
1724* Pinch gesture supported.
1825
@@ -35,12 +42,15 @@ pod 'MD360Player4iOS', '~> 0.2.0'
3542 /////////////////////////////////////////////////////// MDVRLibrary
3643 MDVRConfiguration* config = [MDVRLibrary createConfig];
3744
38- [config displayMode:MDModeDisplayNormal];
39- [config interactiveMode:MDModeInteractiveTouch];
40- // Worked with AVPlayerItem
41- [config asVideo:playerItem];
45+ [config asVideo:playerItem];
4246 [config setContainer:self view:self.view];
4347
48+ // optional
49+ [config displayMode:MDModeDisplayNormal];
50+ [config interactiveMode:MDModeInteractiveMotion];
51+ [config pinchEnabled:true];
52+ [config setDirectorFactory:self];
53+
4454 self.vrLibrary = [config build];
4555 /////////////////////////////////////////////////////// MDVRLibrary
4656}
@@ -51,6 +61,7 @@ pod 'MD360Player4iOS', '~> 0.2.0'
5161typedef NS_ENUM (NSInteger, MDModeInteractive) {
5262 MDModeInteractiveTouch,
5363 MDModeInteractiveMotion,
64+ MDModeInteractiveMotionWithTouch,
5465};
5566
5667typedef NS_ENUM(NSInteger, MDModeDisplay) {
@@ -71,6 +82,89 @@ self.vrLibrary = [config build];
7182/////////////////////////////////////////////////////// MDVRLibrary
7283```
7384
85+ ## Custom Director Factory
86+ ``` objc
87+ @interface VideoPlayerViewController ()<MD360DirectorFactory >
88+ @end
89+
90+ @implementation VideoPlayerViewController
91+ ...
92+ - (void) initPlayer{
93+ ...
94+ /////////////////////////////////////////////////////// MDVRLibrary
95+ MDVRConfiguration* config = [ MDVRLibrary createConfig] ;
96+ ...
97+ [ config setDirectorFactory: self ] ; // pass in the custom factory
98+ ...
99+ self.vrLibrary = [ config build] ;
100+ /////////////////////////////////////////////////////// MDVRLibrary
101+ }
102+
103+ // implement the MD360DirectorFactory protocol here.
104+ - (MD360Director* ) createDirector:(int) index{
105+ MD360Director* director = [[ MD360Director alloc] init] ;
106+ switch (index) {
107+ case 1:
108+ [ director setEyeX:-2.0f] ;
109+ [ director setLookX:-2.0f] ;
110+ break;
111+ default:
112+ break;
113+ }
114+ return director;
115+ }
116+ ...
117+ @end
118+
119+ ```
120+
121+ ## 360 Bitmap Support
122+ ```objc
123+ @interface BitmapPlayerViewController ()<IMDImageProvider>
124+
125+ @end
126+
127+ @implementation BitmapPlayerViewController
128+
129+ ...
130+
131+ - (void) initPlayer{
132+ ...
133+ /////////////////////////////////////////////////////// MDVRLibrary
134+ MDVRConfiguration* config = [MDVRLibrary createConfig];
135+ ...
136+ [config asImage:self];
137+ ...
138+ self.vrLibrary = [config build];
139+ /////////////////////////////////////////////////////// MDVRLibrary
140+
141+ }
142+
143+ // implement the IMDImageProvider protocol here.
144+ -(void) onProvideImage:(id<TextureCallback>)callback{
145+ //
146+ SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
147+ [downloader downloadImageWithURL:self.mURL options:0
148+ progress:^(NSInteger receivedSize, NSInteger expectedSize) {
149+ NSLog(@"progress:%ld/%ld",receivedSize,expectedSize);
150+ // progression tracking code
151+ }
152+ completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
153+ if ( image && finished) {
154+ // do something with image
155+ if ([callback respondsToSelector:@selector(texture:)]) {
156+ [callback texture:image];
157+ }
158+ }
159+ }];
160+
161+
162+ }
163+
164+ @end
165+ ```
166+ See [ BitmapPlayerViewController.m] ( https://github.com/ashqal/MD360Player4iOS/blob/master/MD360Player4iOS/BitmapPlayerViewController.m )
167+
74168## Reference
75169* [ HTY360Player(360 VR Player for iOS)] ( https://github.com/hanton/HTY360Player )
76170* [ VideoPlayer-iOS] ( https://github.com/davidAgo4g/VideoPlayer-iOS )
0 commit comments