com.craftar
Class CraftARContentVideo
- java.lang.Object
-
- com.craftar.CraftARContentBase
-
- com.craftar.CraftARContent
-
- com.craftar.CraftARContentVideo
public class CraftARContentVideo extends CraftARContent
A Video content for aCraftARItemAR
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.craftar.CraftARContent
CraftARContent.ContentStatus, CraftARContent.ContentTouchEvent, CraftARContent.ContentWrapMode, CraftARContent.LoadContentInBackground
-
Nested classes/interfaces inherited from class com.craftar.CraftARContentBase
CraftARContentBase.ContentType, CraftARContentBase.ContentTypeName
-
-
Field Summary
Fields Modifier and Type Field and Description boolean
mAutoPlay
boolean
mLooping
protected boolean
mMuted
protected java.lang.String
mPosterUrl
java.lang.String
mVideoUri
-
Fields inherited from class com.craftar.CraftARContent
isAppInBg, mAlpha, mClickListener, mContentID, mHyperlinkUrl, mId, mNativeContentPtr, mRotationMatrix, mScale, mStatus, mTouchEventListener, mTranslation, mType, mUUID, mWrapMode
-
-
Constructor Summary
Constructors Constructor and Description CraftARContentVideo(JSONObject object)
CraftARContentVideo(java.lang.String videoUri)
Create aCraftARContentVideo
defining it's video programatically.CraftARContentVideo(java.lang.String videoUri, boolean transparencyMask, boolean looping, boolean muted, boolean autoplay)
Create aCraftARContentVideo
defining it's video programatically.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description protected void
cancelContentLoad()
Stop loading this contentprotected void
clearContentResources()
protected void
contentLoadFinalized(boolean success)
The content resources finished loading.protected void
drawWithItemPose(float[] translation, float[] rotation, int drawMode)
Draws the content according to it's parent ARItem pose.protected void
finalize()
int
getPositionMS()
Gets the current playback position.protected boolean
hasTransparencyMask()
boolean
isLooping()
Checks whether the video is looping or non-looping.void
onAppFinish()
void
onAppPause()
void
onAppResume()
protected void
onVideoLoaded(int videoWidth, int videoHeight)
void
pause()
Pause the video if it has been already loaded.void
play()
Start playing the video if it has been already loaded.protected void
playbackFinished()
void
seekTo(float percent)
Seek to a specific point of the video, specified by a percentage.void
seekTo(int ms)
Seek to a specific point of the video, specified in ms.void
setAutoPlay(boolean doAutoplay)
Sets the autoplay parameter.void
setLooping(boolean bL)
Sets the player to be looping or non-looping.void
setMuted(boolean muted)
Mute the videovoid
stop()
Stop the video if it has been already loaded.void
toogleFullScreen()
protected void
trackingLost()
Called when the parent ARItem tracking is lostprotected void
trackingStarted()
Called when the parent ARItem starts being tracked.void
update()
Internal updateprotected void
updateContentAttributes()
Receives a notification that the content attributes (scale, pose, translation) have been modified.-
Methods inherited from class com.craftar.CraftARContent
getAlpha, getContentType, getRotationMatrix, getScale, getStatus, getTranslation, getUUID, getWrapMode, onDestroyedForOrientationChange, setAlpha, setContentClickListener, setContentTouchEventListener, setContentVersion, setRotationMatrix, setScale, setTranslation, setWrapMode
-
Methods inherited from class com.craftar.CraftARContentBase
contentTypeFromJSON
-
-
-
-
Field Detail
-
mVideoUri
public java.lang.String mVideoUri
-
mAutoPlay
public boolean mAutoPlay
-
mLooping
public boolean mLooping
-
mMuted
protected boolean mMuted
-
mPosterUrl
protected java.lang.String mPosterUrl
-
-
Constructor Detail
-
CraftARContentVideo
public CraftARContentVideo(java.lang.String videoUri)
Create aCraftARContentVideo
defining it's video programatically.- Parameters:
videoUri
- Can be either a URL (http://example.com/video.mp4) or a local URI.
-
CraftARContentVideo
public CraftARContentVideo(java.lang.String videoUri, boolean transparencyMask, boolean looping, boolean muted, boolean autoplay)
Create aCraftARContentVideo
defining it's video programatically.- Parameters:
videoUri
- Can be either a URL (http://example.com/video.mp4) or a local URI.transparencyMask
- Whether the video has a transparency mask
-
CraftARContentVideo
public CraftARContentVideo(JSONObject object) throws CraftARSDKException
- Throws:
CraftARSDKException
-
-
Method Detail
-
finalize
protected void finalize()
- Overrides:
finalize
in classCraftARContent
-
clearContentResources
protected void clearContentResources()
- Overrides:
clearContentResources
in classCraftARContentBase
-
drawWithItemPose
protected void drawWithItemPose(float[] translation, float[] rotation, int drawMode)
Draws the content according to it's parent ARItem pose.- Specified by:
drawWithItemPose
in classCraftARContent
-
onVideoLoaded
protected void onVideoLoaded(int videoWidth, int videoHeight)
-
contentLoadFinalized
protected void contentLoadFinalized(boolean success)
The content resources finished loading.- Specified by:
contentLoadFinalized
in classCraftARContent
- Parameters:
success
- True if the content was loaded successfully, false otherwise.
-
cancelContentLoad
protected void cancelContentLoad()
Stop loading this content- Overrides:
cancelContentLoad
in classCraftARContent
-
updateContentAttributes
protected void updateContentAttributes()
Receives a notification that the content attributes (scale, pose, translation) have been modified. You can modify the attributes of anyCraftARContent
using the methods setTranslation , setRotationMatrix, and setScale.- Specified by:
updateContentAttributes
in classCraftARContent
-
update
public void update()
Description copied from class:CraftARContent
Internal update- Overrides:
update
in classCraftARContent
-
onAppResume
public void onAppResume()
- Overrides:
onAppResume
in classCraftARContent
-
onAppPause
public void onAppPause()
- Overrides:
onAppPause
in classCraftARContent
-
onAppFinish
public void onAppFinish()
- Overrides:
onAppFinish
in classCraftARContent
-
trackingStarted
protected void trackingStarted()
Description copied from class:CraftARContentBase
Called when the parent ARItem starts being tracked.- Overrides:
trackingStarted
in classCraftARContentBase
-
trackingLost
protected void trackingLost()
Description copied from class:CraftARContentBase
Called when the parent ARItem tracking is lost- Overrides:
trackingLost
in classCraftARContentBase
-
playbackFinished
protected void playbackFinished()
-
play
public void play()
Start playing the video if it has been already loaded. Otherwise, does nothing.
-
pause
public void pause()
Pause the video if it has been already loaded. Otherwise, does nothing.
-
stop
public void stop()
Stop the video if it has been already loaded. Otherwise, does nothing.
-
setMuted
public void setMuted(boolean muted)
Mute the video
-
setAutoPlay
public void setAutoPlay(boolean doAutoplay)
Sets the autoplay parameter. If autoplay is enabled, the video is automatically being played/paused when the video is loaded, at trackingStarted() and trackingLost() events, and onPause and onResume() events.
-
seekTo
public void seekTo(float percent)
Seek to a specific point of the video, specified by a percentage.
-
seekTo
public void seekTo(int ms)
Seek to a specific point of the video, specified in ms.
-
setLooping
public void setLooping(boolean bL)
Sets the player to be looping or non-looping.- Parameters:
looping
- whether to loop or not
-
isLooping
public boolean isLooping()
Checks whether the video is looping or non-looping.- Returns:
- true if the video is currently looping, false otherwise
-
getPositionMS
public int getPositionMS()
Gets the current playback position.- Returns:
- the current position in milliseconds
-
toogleFullScreen
public void toogleFullScreen()
-
hasTransparencyMask
protected boolean hasTransparencyMask()
-
-
Comments
0 comments
Article is closed for comments.