當前位置: 首頁>>代碼示例>>Java>>正文


Java Video類代碼示例

本文整理匯總了Java中android.provider.MediaStore.Video的典型用法代碼示例。如果您正苦於以下問題:Java Video類的具體用法?Java Video怎麽用?Java Video使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Video類屬於android.provider.MediaStore包,在下文中一共展示了Video類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createFinalPath

import android.provider.MediaStore.Video; //導入依賴的package包/類
public static String createFinalPath(Context context)
{
	long dateTaken = System.currentTimeMillis();
	String title = CONSTANTS.FILE_START_NAME + dateTaken;
	String filename = title + CONSTANTS.VIDEO_EXTENSION;
	String filePath = genrateFilePath(context,String.valueOf(dateTaken), true, null);
	
	ContentValues values = new ContentValues(7);
	values.put(Video.Media.TITLE, title);
	values.put(Video.Media.DISPLAY_NAME, filename);
	values.put(Video.Media.DATE_TAKEN, dateTaken);
	values.put(Video.Media.MIME_TYPE, "video/3gpp");
	values.put(Video.Media.DATA, filePath);
	videoContentValues = values;

	return filePath;
}
 
開發者ID:feigxj,項目名稱:VideoRecorder-master,代碼行數:18,代碼來源:Util.java

示例2: loadBucketEntriesFromImagesAndVideoTable

import android.provider.MediaStore.Video; //導入依賴的package包/類
private static BucketEntry[] loadBucketEntriesFromImagesAndVideoTable(
        ThreadPool.JobContext jc, ContentResolver resolver, int type) {
    HashMap<Integer, BucketEntry> buckets = new HashMap<Integer, BucketEntry>(64);
    if ((type & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
        updateBucketEntriesFromTable(
                jc, resolver, Images.Media.EXTERNAL_CONTENT_URI, buckets);
    }
    if ((type & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
        updateBucketEntriesFromTable(
                jc, resolver, Video.Media.EXTERNAL_CONTENT_URI, buckets);
    }
    BucketEntry[] entries = buckets.values().toArray(new BucketEntry[buckets.size()]);
    Arrays.sort(entries, new Comparator<BucketEntry>() {
        @Override
        public int compare(BucketEntry a, BucketEntry b) {
            // sorted by dateTaken in descending order
            return b.dateTaken - a.dateTaken;
        }
    });
    return entries;
}
 
開發者ID:mayurkaul,項目名稱:medialibrary,代碼行數:22,代碼來源:BucketHelper.java

示例3: LocalVideo

import android.provider.MediaStore.Video; //導入依賴的package包/類
public LocalVideo(Path path, MediaDataContext context, int id) {
    super(path, nextVersionNumber());
    mApplication = context;
    ContentResolver resolver = mApplication.getContentResolver();
    Uri uri = Video.Media.EXTERNAL_CONTENT_URI;
    Cursor cursor = LocalAlbum.getItemCursor(resolver, uri, PROJECTION, id);
    if (cursor == null) {
        throw new RuntimeException("cannot get cursor for: " + path);
    }
    try {
        if (cursor.moveToNext()) {
            loadFromCursor(cursor);
        } else {
            throw new RuntimeException("cannot find data for: " + path);
        }
    } finally {
        cursor.close();
    }
}
 
開發者ID:mayurkaul,項目名稱:medialibrary,代碼行數:20,代碼來源:LocalVideo.java

示例4: getVideoForBucketCleared

import android.provider.MediaStore.Video; //導入依賴的package包/類
protected long getVideoForBucketCleared(long bucketId)
        throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();
    Cursor cursor = null;
    try {
        cursor = resolver.query(Video.Media.EXTERNAL_CONTENT_URI,
                VideosBucketThumbnailQuery.PROJECTION, VideoColumns.BUCKET_ID + "=" + bucketId,
                null, VideoColumns.DATE_MODIFIED + " DESC");
        if (cursor.moveToFirst()) {
            return cursor.getLong(VideosBucketThumbnailQuery._ID);
        }
    } finally {
        IoUtils.closeQuietly(cursor);
    }
    throw new FileNotFoundException("No video found for bucket");
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:17,代碼來源:StorageProvider.java

示例5: openVideoThumbnailCleared

import android.provider.MediaStore.Video; //導入依賴的package包/類
protected AssetFileDescriptor openVideoThumbnailCleared(long id, CancellationSignal signal)
        throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();
    Cursor cursor = null;
    try {
        cursor = resolver.query(Video.Thumbnails.EXTERNAL_CONTENT_URI,
                VideoThumbnailQuery.PROJECTION, Video.Thumbnails.VIDEO_ID + "=" + id, null,
                null);
        if (cursor.moveToFirst()) {
            final String data = cursor.getString(VideoThumbnailQuery._DATA);
            return new AssetFileDescriptor(ParcelFileDescriptor.open(
                    new File(data), ParcelFileDescriptor.MODE_READ_ONLY), 0,
                    AssetFileDescriptor.UNKNOWN_LENGTH);
        }
    } finally {
        IoUtils.closeQuietly(cursor);
    }
    return null;
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:20,代碼來源:StorageProvider.java

示例6: openOrCreateVideoThumbnailCleared

import android.provider.MediaStore.Video; //導入依賴的package包/類
protected AssetFileDescriptor openOrCreateVideoThumbnailCleared(
        long id, CancellationSignal signal) throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();

    AssetFileDescriptor afd = openVideoThumbnailCleared(id, signal);
    if (afd == null) {
        // No thumbnail yet, so generate. This is messy, since we drop the
        // Bitmap on the floor, but its the least-complicated way.
        final BitmapFactory.Options opts = new BitmapFactory.Options();
        opts.inJustDecodeBounds = true;
        Video.Thumbnails.getThumbnail(resolver, id, Video.Thumbnails.MINI_KIND, opts);

        afd = openVideoThumbnailCleared(id, signal);
    }

    return afd;
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:18,代碼來源:StorageProvider.java

示例7: cancelThreadDecoding

import android.provider.MediaStore.Video; //導入依賴的package包/類
public synchronized void cancelThreadDecoding(Thread t, ContentResolver cr) {
    ThreadStatus status = getOrCreateThreadStatus(t);
    status.mState = State.CANCEL;
    if (status.mOptions != null) {
        status.mOptions.requestCancelDecode();
    }

    // Wake up threads in waiting list
    notifyAll();

    // Since our cancel request can arrive MediaProvider earlier than getThumbnail request,
    // we use mThumbRequesting flag to make sure our request does cancel the request.
    try {
        synchronized (status) {
            while (status.mThumbRequesting) {
                Images.Thumbnails.cancelThumbnailRequest(cr, -1, t.getId());
                Video.Thumbnails.cancelThumbnailRequest(cr, -1, t.getId());
                status.wait(200);
            }
        }
    } catch (InterruptedException ex) {
        // ignore it.
    }
}
 
開發者ID:goodev,項目名稱:droidddle,代碼行數:25,代碼來源:BitmapManager.java

示例8: getThumbnail

import android.provider.MediaStore.Video; //導入依賴的package包/類
public Bitmap getThumbnail(ContentResolver cr, long origId, int kind, BitmapFactory.Options options, boolean isVideo) {
    Thread t = Thread.currentThread();
    ThreadStatus status = getOrCreateThreadStatus(t);

    if (!canThreadDecoding(t)) {
        Log.d(TAG, "Thread " + t + " is not allowed to decode.");
        return null;
    }

    try {
        synchronized (status) {
            status.mThumbRequesting = true;
        }
        if (isVideo) {
            return Video.Thumbnails.getThumbnail(cr, origId, t.getId(), kind, null);
        } else {
            return Images.Thumbnails.getThumbnail(cr, origId, t.getId(), kind, null);
        }
    } finally {
        synchronized (status) {
            status.mThumbRequesting = false;
            status.notifyAll();
        }
    }
}
 
開發者ID:goodev,項目名稱:droidddle,代碼行數:26,代碼來源:BitmapManager.java

示例9: shareVideo

import android.provider.MediaStore.Video; //導入依賴的package包/類
private void shareVideo(){
       String outputFile = currentTimelap.getPath();     
      
       ContentValues content = new ContentValues(4);
       content.put(Video.VideoColumns.TITLE, currentTimelap.getName());
       content.put(Video.VideoColumns.DATE_ADDED,
       System.currentTimeMillis() / 1000);
       content.put(Video.Media.MIME_TYPE, "video/mp4");
       content.put(MediaStore.Video.Media.DATA, outputFile);
       ContentResolver resolver = getContentResolver();
       Uri uri = resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
       content);
      
       Intent intent = new Intent(Intent.ACTION_SEND);
       intent.setType("video/*");
       intent.putExtra(Intent.EXTRA_STREAM, uri);
       startActivity(Intent.createChooser(intent, "Share using"));		
}
 
開發者ID:icrisu,項目名稱:In-Time-Android-Native-App-,代碼行數:19,代碼來源:MovieSingle.java

示例10: onPause

import android.provider.MediaStore.Video; //導入依賴的package包/類
@Override
protected void onPause() {
    super.onPause();

    // 受信を停止.
    unregisterReceiver(mReceiver);

    if (checkAudioFile()) {
        // Contents Providerに登録.
        ContentResolver resolver = this.getApplicationContext().getContentResolver();
        ContentValues values = new ContentValues();
        values.put(Video.Media.TITLE, mFileName);
        values.put(Video.Media.DISPLAY_NAME, mFileName);
        values.put(Video.Media.ARTIST, "DeviceConnect");
        values.put(Video.Media.MIME_TYPE, AudioConst.FORMAT_TYPE);
        values.put(Video.Media.DATA, mFile.toString());
        resolver.insert(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, values);
    }
    releaseMediaRecorder();
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:21,代碼來源:AudioRecorderActivity.java

示例11: saveVideo

import android.provider.MediaStore.Video; //導入依賴的package包/類
private void saveVideo() {
    if (mVideoFileDescriptor == null) {
        long duration = SystemClock.uptimeMillis() - mRecordingStartTime;
        if (duration > 0) {
            //
        } else {
            Log.w(TAG, "Video duration <= 0 : " + duration);
        }
        mCurrentVideoValues.put(Video.Media.SIZE, new File(mCurrentVideoFilename).length());
        mCurrentVideoValues.put(Video.Media.DURATION, duration);
        getServices().getMediaSaver().addVideo(mCurrentVideoFilename,
                mCurrentVideoValues, mOnVideoSavedListener, mContentResolver);
        logVideoCapture(duration);
    }
    mCurrentVideoValues = null;
}
 
開發者ID:jameliu,項目名稱:Camera2,代碼行數:17,代碼來源:VideoModule.java

示例12: doInBackground

import android.provider.MediaStore.Video; //導入依賴的package包/類
@Override
protected Uri doInBackground(Void... v) {
    Uri uri = null;
    try {
        Uri videoTable = Uri.parse(VIDEO_BASE_URI);
        uri = resolver.insert(videoTable, values);

        // Rename the video file to the final name. This avoids other
        // apps reading incomplete data.  We need to do it after we are
        // certain that the previous insert to MediaProvider is completed.
        String finalName = values.getAsString(Video.Media.DATA);
        File finalFile = new File(finalName);
        if (new File(path).renameTo(finalFile)) {
            path = finalName;
        }
        resolver.update(uri, values, null, null);
    } catch (Exception e) {
        // We failed to insert into the database. This can happen if
        // the SD card is unmounted.
        Log.e(TAG, "failed to add video to media store", e);
        uri = null;
    } finally {
        Log.v(TAG, "Current video URI: " + uri);
    }
    return uri;
}
 
開發者ID:jameliu,項目名稱:Camera2,代碼行數:27,代碼來源:MediaSaverImpl.java

示例13: loadBucketEntriesFromImagesAndVideoTable

import android.provider.MediaStore.Video; //導入依賴的package包/類
private static BucketEntry[] loadBucketEntriesFromImagesAndVideoTable(
        JobContext jc, ContentResolver resolver, int type) {
    HashMap<Integer, BucketEntry> buckets = new HashMap<Integer, BucketEntry>(64);
    if ((type & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
        updateBucketEntriesFromTable(
                jc, resolver, Images.Media.EXTERNAL_CONTENT_URI, buckets);
    }
    if ((type & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
        updateBucketEntriesFromTable(
                jc, resolver, Video.Media.EXTERNAL_CONTENT_URI, buckets);
    }
    BucketEntry[] entries = buckets.values().toArray(new BucketEntry[buckets.size()]);
    Arrays.sort(entries, new Comparator<BucketEntry>() {
        @Override
        public int compare(BucketEntry a, BucketEntry b) {
            // sorted by dateTaken in descending order
            return b.dateTaken - a.dateTaken;
        }
    });
    return entries;
}
 
開發者ID:asm-products,項目名稱:nexus-gallery,代碼行數:22,代碼來源:BucketHelper.java

示例14: LocalAlbum

import android.provider.MediaStore.Video; //導入依賴的package包/類
public LocalAlbum(Path path, GalleryApp application, int bucketId,
        boolean isImage, String name) {
    super(path, nextVersionNumber());
    mApplication = application;
    mResolver = application.getContentResolver();
    mBucketId = bucketId;
    mName = name;
    mIsImage = isImage;

    if (isImage) {
        mWhereClause = ImageColumns.BUCKET_ID + " = ?";
        mOrderClause = ImageColumns.DATE_TAKEN + " DESC, "
                + ImageColumns._ID + " DESC";
        mBaseUri = Images.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalImage.PROJECTION;
        mItemPath = LocalImage.ITEM_PATH;
    } else {
        mWhereClause = VideoColumns.BUCKET_ID + " = ?";
        mOrderClause = VideoColumns.DATE_TAKEN + " DESC, "
                + VideoColumns._ID + " DESC";
        mBaseUri = Video.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalVideo.PROJECTION;
        mItemPath = LocalVideo.ITEM_PATH;
    }

    mNotifier = new ChangeNotifier(this, mBaseUri, application);
}
 
開發者ID:asm-products,項目名稱:nexus-gallery,代碼行數:28,代碼來源:LocalAlbum.java

示例15: updateExistingItems

import android.provider.MediaStore.Video; //導入依賴的package包/類
private void updateExistingItems() {
    if (mAllItems.size() == 0) return;

    // Query existing ids.
    ArrayList<Integer> imageIds = queryExistingIds(
            Images.Media.EXTERNAL_CONTENT_URI, mMinImageId, mMaxImageId);
    ArrayList<Integer> videoIds = queryExistingIds(
            Video.Media.EXTERNAL_CONTENT_URI, mMinVideoId, mMaxVideoId);

    // Construct the existing items list.
    mExistingItems.clear();
    for (int i = mAllItems.size() - 1; i >= 0; i--) {
        Path path = mAllItems.get(i);
        boolean isVideo = mAllItemTypes.get(i);
        int id = Integer.parseInt(path.getSuffix());
        if (isVideo) {
            if (videoIds.contains(id)) mExistingItems.add(path);
        } else {
            if (imageIds.contains(id)) mExistingItems.add(path);
        }
    }
}
 
開發者ID:asm-products,項目名稱:nexus-gallery,代碼行數:23,代碼來源:SecureAlbum.java


注:本文中的android.provider.MediaStore.Video類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。