FileDocCategorySizeDatePackage
VideoModel.javaAPI DocAndroid 1.5 API4906Wed May 06 22:42:46 BST 2009com.android.mms.model

VideoModel

public class VideoModel extends RegionMediaModel

Fields Summary
private static final String
TAG
private static final boolean
DEBUG
private static final boolean
LOCAL_LOGV
Constructors Summary
public VideoModel(android.content.Context context, android.net.Uri uri, RegionModel region)


          
              
        this(context, null, null, uri, region);
        initModelFromUri(uri);
        checkContentRestriction();
    
public VideoModel(android.content.Context context, String contentType, String src, android.net.Uri uri, RegionModel region)

        super(context, SmilHelper.ELEMENT_TAG_VIDEO, contentType, src, uri, region);
    
public VideoModel(android.content.Context context, String contentType, String src, com.android.mms.drm.DrmWrapper wrapper, RegionModel regionModel)

        super(context, SmilHelper.ELEMENT_TAG_VIDEO, contentType, src, wrapper, regionModel);
    
Methods Summary
protected voidcheckContentRestriction()

        ContentRestriction cr = ContentRestrictionFactory.getContentRestriction();
        cr.checkVideoContentType(mContentType);
    
public voidhandleEvent(org.w3c.dom.events.Event evt)

        String evtType = evt.getType();
        if (LOCAL_LOGV) {
            Log.v(TAG, "Handling event: " + evt.getType() + " on " + this);
        }

        MediaAction action = MediaAction.NO_ACTIVE_ACTION;
        if (evtType.equals(SmilMediaElementImpl.SMIL_MEDIA_START_EVENT)) {
            action = MediaAction.START;
            mVisible = true;
        } else if (evtType.equals(SmilMediaElementImpl.SMIL_MEDIA_END_EVENT)) {
            action = MediaAction.STOP;
            if (mFill != ElementTime.FILL_FREEZE) {
                mVisible = false;
            }
        } else if (evtType.equals(SmilMediaElementImpl.SMIL_MEDIA_PAUSE_EVENT)) {
            action = MediaAction.PAUSE;
            mVisible = true;
        } else if (evtType.equals(SmilMediaElementImpl.SMIL_MEDIA_SEEK_EVENT)) {
            action = MediaAction.SEEK;
            mSeekTo = evt.getSeekTo();
            mVisible = true;
        }

        appendAction(action);
        notifyModelChanged(false);
    
private voidinitModelFromUri(android.net.Uri uri)

        ContentResolver cr = mContext.getContentResolver();
        Cursor c = SqliteWrapper.query(mContext, cr, uri, null, null, null, null);

        if (c != null) {
            try {
                if (c.moveToFirst()) {
                    String path = c.getString(c.getColumnIndexOrThrow(Images.Media.DATA));
                    mSrc = path.substring(path.lastIndexOf('/") + 1);
                    mContentType = c.getString(c.getColumnIndexOrThrow(
                            Images.Media.MIME_TYPE));
                    if (TextUtils.isEmpty(mContentType)) {
                        throw new MmsException("Type of media is unknown.");
                    }

                    if (LOCAL_LOGV) {
                        Log.v(TAG, "New VideoModel created:"
                                + " mSrc=" + mSrc
                                + " mContentType=" + mContentType
                                + " mUri=" + uri);
                    }
                } else {
                    throw new MmsException("Nothing found: " + uri);
                }
            } finally {
                c.close();
            }
        } else {
            throw new MmsException("Bad URI: " + uri);
        }

        initMediaDuration();
    
protected booleanisPlayable()

        return true;