add currentTime and duration in iOS

This commit is contained in:
zilongshanren
2016-08-15 19:55:13 +08:00
parent 25891d2f4b
commit d5fbdb1e53
2 changed files with 35 additions and 0 deletions
+28
View File
@@ -45,6 +45,8 @@ using namespace cocos2d::experimental::ui;
- (void) resume;
- (void) stop;
- (void) seekTo:(float) sec;
- (float) currentTime;
- (float) duration;
- (void) setVisible:(BOOL) visible;
- (void) setKeepRatioEnabled:(bool) enabled;
- (void) setFullScreenEnabled:(bool) enabled;
@@ -207,6 +209,22 @@ using namespace cocos2d::experimental::ui;
}
}
-(float) currentTime
{
if (self.moviePlayer != NULL) {
return [self.moviePlayer currentPlaybackTime];
}
return -1;
}
-(float) duration
{
if (self.moviePlayer != NULL) {
return [self.moviePlayer duration];
}
return -1;
}
-(void) setVisible:(BOOL)visible
{
if (self.moviePlayer != NULL) {
@@ -409,6 +427,16 @@ void VideoPlayer::seekTo(float sec)
}
}
float VideoPlayer::currentTime()const
{
return [((UIVideoViewWrapperIos*)_videoView) currentTime];
}
float VideoPlayer::duration()const
{
return [((UIVideoViewWrapperIos*)_videoView) duration];
}
bool VideoPlayer::isPlaying() const
{
return _isPlaying;
+7
View File
@@ -122,6 +122,13 @@ namespace experimental{
*/
virtual void seekTo(float sec);
/**
* Get the current play time, measure in seconds.
*/
float currentTime()const;
float duration() const;
/**
* Checks whether the VideoPlayer is playing.
*