Search in sources :

Example 1 with ElementTime

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);
}
Also used : NodeListImpl(com.android.mms.dom.NodeListImpl) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) ArrayList(java.util.ArrayList) ElementTime(org.w3c.dom.smil.ElementTime) Time(org.w3c.dom.smil.Time) ElementTime(org.w3c.dom.smil.ElementTime) TimeList(org.w3c.dom.smil.TimeList)

Example 2 with ElementTime

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;
}
Also used : NodeList(org.w3c.dom.NodeList) ElementTime(org.w3c.dom.smil.ElementTime)

Example 3 with ElementTime

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();
    }
}
Also used : ElementTime(org.w3c.dom.smil.ElementTime)

Example 4 with ElementTime

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));
        }
    }
}
Also used : ElementTime(org.w3c.dom.smil.ElementTime)

Example 5 with ElementTime

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();
    }
}
Also used : ElementTime(org.w3c.dom.smil.ElementTime)

Aggregations

ElementTime (org.w3c.dom.smil.ElementTime)14 NodeList (org.w3c.dom.NodeList)10 Time (org.w3c.dom.smil.Time)6 TimeList (org.w3c.dom.smil.TimeList)6 ArrayList (java.util.ArrayList)4 Node (org.w3c.dom.Node)4 DocumentEvent (org.w3c.dom.events.DocumentEvent)2 Event (org.w3c.dom.events.Event)2 SMILElement (org.w3c.dom.smil.SMILElement)2 NodeListImpl (com.android.mms.dom.NodeListImpl)1 NodeListImpl (org.thoughtcrime.securesms.dom.NodeListImpl)1