mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
add currentTime and duration in iOS
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user