Cocos Creator API

1.4.x

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

VideoPlayer

Module: cc

cc.VideoPlayer is a component for playing videos, you can use it for showing videos in your game.

Properties

resourceType VideoPlayer.ResourceType

The resource type of videoplayer, REMOTE for remote url and LOCAL for local file path.

remoteURL String

The remote URL of video.

clip String

The local video full path.

currentTime Number

The current playback time of the now playing item in seconds, you could also change the start playback time.

keepAspectRatio Boolean

Whether keep the aspect ration of the original video.

isFullscreen Boolean

Whether play video in fullscreen mode.

videoPlayerEvent Component.EventHandler[]

the video player's callback, it will be triggered when certain event occurs, like: playing, paused, stopped and completed.

_sgNode _ccsg.Node private

Reference to the instance of _ccsg.Node If it is possible to return null from your overloaded _createSgNode, then you should always check for null before using this property and reimplement __preload.

__eventTargets Array private

Inherited from Component:

Register all related EventTargets, all event callbacks will be removed in _onPreDestroy

node Node

Inherited from Component:

The node this component is attached to. A component is always attached to a node.

examples:

cc.log(comp.node);

uuid String readOnly

Inherited from Component:

The uuid for editor.

examples:

cc.log(comp.uuid);

_enabled Boolean private

Inherited from Component:

enabled Boolean

Inherited from Component:

indicates whether this component is enabled or not.

examples:

comp.enabled = true;
cc.log(comp.enabled);

enabledInHierarchy Boolean readOnly

Inherited from Component:

indicates whether this component is enabled and its node is also active in the hierarchy.

examples:

cc.log(comp.enabledInHierarchy);

_isOnLoadCalled Boolean readOnly

Inherited from Component:

TODO

examples:

cc.log(_isOnLoadCalled);

_name String private

_objFlags Number private

name String

The name of the object.

examples:

obj.name = "New Obj";

isValid Boolean readOnly

Indicates whether the object is not yet destroyed.

examples:

cc.log(obj.isValid);

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

play ( )

If a video is paused, call this method could resume playing. If a video is stopped, call this method to play from scratch.

resume ( )

If a video is paused, call this method to resume playing.

pause ( )

If a video is playing, call this method to pause playing.

stop ( )

If a video is playing, call this method to stop playing immediately.

_createSgNode ( ) _ccsg.Node private

Create and returns your new scene graph node (SGNode) to add to scene graph. You should call the setContentSize of the SGNode if its size should be the same with the node's.

returns:

type: _ccsg.Node

_initSgNode ( ) private

_removeSgNode ( ) private

update ( )

Inherited from Component:

Update is called every frame, if the Component is enabled.

lateUpdate ( )

Inherited from Component:

LateUpdate is called every frame, if the Component is enabled.

__preload ( ) private

Inherited from Component:

__preload is called before every onLoad. It is used to initialize the builtin components internally, to avoid checking whether onLoad is called before every public method calls. This method should be removed if script priority