use of org.w3c.dom.smil.ElementTime in project qksms by moezbhatti.
the class ElementParallelTimeContainerImpl method getActiveChildrenAt.
public NodeList getActiveChildrenAt(float instant) {
/*
* Find the closest Time of ElementTime before instant.
* Add ElementTime to list of active elements if the Time belongs to the begin-list,
* do not add it otherwise.
*/
ArrayList<Node> activeChildren = new ArrayList<Node>();
NodeList children = getTimeChildren();
int childrenLen = children.getLength();
for (int i = 0; i < childrenLen; ++i) {
double maxOffset = 0.0;
boolean active = false;
ElementTime child = (ElementTime) children.item(i);
TimeList beginList = child.getBegin();
int len = beginList.getLength();
for (int j = 0; j < len; ++j) {
Time begin = beginList.item(j);
if (begin.getResolved()) {
double resolvedOffset = begin.getResolvedOffset() * 1000.0;
if ((resolvedOffset <= instant) && (resolvedOffset >= maxOffset)) {
maxOffset = resolvedOffset;
active = true;
}
}
}
TimeList endList = child.getEnd();
len = endList.getLength();
for (int j = 0; j < len; ++j) {
Time end = endList.item(j);
if (end.getResolved()) {
double resolvedOffset = end.getResolvedOffset() * 1000.0;
if ((resolvedOffset <= instant) && (resolvedOffset >= maxOffset)) {
maxOffset = resolvedOffset;
active = false;
}
}
}
if (active) {
activeChildren.add((Node) child);
}
}
return new NodeListImpl(activeChildren);
}
use of org.w3c.dom.smil.ElementTime in project qksms by moezbhatti.
the class ElementSequentialTimeContainerImpl method getDur.
public float getDur() {
float dur = super.getDur();
if (dur == 0) {
NodeList children = getTimeChildren();
for (int i = 0; i < children.getLength(); ++i) {
ElementTime child = (ElementTime) children.item(i);
if (child.getDur() < 0) {
// Return "indefinite" since containing a child whose duration is indefinite.
return -1.0F;
}
dur += child.getDur();
}
}
return dur;
}
use of org.w3c.dom.smil.ElementTime in project qksms by moezbhatti.
the class SmilPlayer method pauseActiveElements.
private synchronized void pauseActiveElements() {
for (int i = mActiveElements.size() - 1; i >= 0; i--) {
ElementTime element = mActiveElements.get(i);
if (LOCAL_LOGV)
Log.v(TAG, "[PAUSE] " + " at " + mCurrentTime + " " + element);
element.pauseElement();
}
}
use of org.w3c.dom.smil.ElementTime in project qksms by moezbhatti.
the class SmilPlayer method seekActiveMedia.
private synchronized void seekActiveMedia() {
for (int i = mActiveElements.size() - 1; i >= 0; i--) {
ElementTime element = mActiveElements.get(i);
if (element instanceof SmilParElementImpl) {
return;
}
double offset = getOffsetTime(element);
if ((offset >= 0) && (offset <= mCurrentTime)) {
if (LOCAL_LOGV)
Log.v(TAG, "[SEEK] " + " at " + mCurrentTime + " " + element);
element.seekElement((float) (mCurrentTime - offset));
}
}
}
use of org.w3c.dom.smil.ElementTime in project qksms by moezbhatti.
the class SmilPlayer method resumeActiveElements.
private synchronized void resumeActiveElements() {
int size = mActiveElements.size();
for (int i = 0; i < size; i++) {
ElementTime element = mActiveElements.get(i);
if (LOCAL_LOGV)
Log.v(TAG, "[RESUME] " + " at " + mCurrentTime + " " + element);
element.resumeElement();
}
}
Aggregations