当前位置: 首页>>代码示例>>Java>>正文


Java VideoItem类代码示例

本文整理汇总了Java中org.fourthline.cling.support.model.item.VideoItem的典型用法代码示例。如果您正苦于以下问题:Java VideoItem类的具体用法?Java VideoItem怎么用?Java VideoItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VideoItem类属于org.fourthline.cling.support.model.item包,在下文中一共展示了VideoItem类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: browseItem

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
@Override
public List<Item> browseItem(YaaccContentDirectory contentDirectory, String myId) {
	List<Item> result = new ArrayList<Item>();
	String[] projection = { MediaStore.Video.Media._ID, MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.MIME_TYPE,
			MediaStore.Video.Media.SIZE, MediaStore.Video.Media.DURATION };
	String selection = "";
	String[] selectionArgs = null;
	Cursor mediaCursor = contentDirectory.getContext().getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, selection,
			selectionArgs, MediaStore.Video.Media.DISPLAY_NAME + " ASC");

	if (mediaCursor != null) {
		mediaCursor.moveToFirst();
		while (!mediaCursor.isAfterLast()) {
			String id = mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.VideoColumns._ID));
			String name = mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.VideoColumns.DISPLAY_NAME));
			String duration = mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.VideoColumns.DURATION));
			duration = contentDirectory.formatDuration(duration);
			Long size = Long.valueOf(mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.VideoColumns.SIZE)));
			Log.d(getClass().getName(), "Mimetype: " + mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.VideoColumns.MIME_TYPE)));
			MimeType mimeType = MimeType.valueOf(mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Video.VideoColumns.MIME_TYPE)));
			// file parameter only needed for media players which decide the
			// ability of playing a file by the file extension
               String uri = getUriString(contentDirectory, id, mimeType);
			Res resource = new Res(mimeType, size, uri);
			resource.setDuration(duration);
			result.add(new VideoItem(ContentDirectoryIDs.VIDEO_PREFIX.getId() +  id, ContentDirectoryIDs.VIDEOS_FOLDER.getId(), name, "", resource));
			Log.d(getClass().getName(), "VideoItem: " + id + " Name: " + name + " uri: " + uri);
			mediaCursor.moveToNext();
		}
		mediaCursor.close();
	} else {
		Log.d(getClass().getName(), "System media store is empty.");
	}
	return result;
	
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:37,代码来源:VideosFolderBrowser.java

示例2: performAction

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
private void performAction(DIDLObject object) {
	if (Utils.isVideo(object)) {
		playVideo((VideoItem) object);
	} else if (Utils.isAudio(object)) {
		playAudio((AudioItem) object);
	} else if (Utils.isImage(object)) {
		openImage((ImageItem) object);
	} else if (Utils.isPlayList(object)) {

	} else {
		openFile(object);
	}
}
 
开发者ID:msafin,项目名称:wmc,代码行数:14,代码来源:DlnaDetailFragment.java

示例3: getView

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	ViewHolder holder = null;

	if (convertView == null) {
		convertView = mInflator.inflate(R.layout.browse_item, parent,
				false);

		holder = new ViewHolder();
		holder.icon = (ImageView) convertView
				.findViewById(R.id.browseItemIcon);
		holder.name = (TextView) convertView
				.findViewById(R.id.browseItemName);
		convertView.setTag(holder);
	} else {
		holder = (ViewHolder) convertView.getTag();
	}

	DIDLObject currentObject = (DIDLObject) getItem(position);

	holder.name.setText(currentObject.getTitle());

	if (currentObject instanceof Container) {
		holder.icon.setImageResource(R.drawable.folder);
	} else if (currentObject instanceof AudioItem) {
		holder.icon.setImageResource(R.drawable.cdtrack);
	} else if (currentObject instanceof ImageItem) {
		holder.icon.setImageResource(R.drawable.image);
	} else if (currentObject instanceof VideoItem) {
		holder.icon.setImageResource(R.drawable.video);
	} else if (currentObject instanceof PlaylistItem) {
		holder.icon.setImageResource(R.drawable.playlist);
	} else if (currentObject instanceof TextItem) {
		holder.icon.setImageResource(R.drawable.txt);
	} else {
		holder.icon.setImageResource(R.drawable.unknown);
	}

	return convertView;
}
 
开发者ID:msafin,项目名称:wmc,代码行数:41,代码来源:DlnaDetailFragment.java

示例4: addVideoContent

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
/**
     * 添加视频
     */
    private void addVideoContent(Context context, ContentNode rootNode) {

        Container videoContainer = new Container();
        videoContainer.setClazz(new DIDLObject.Class("object.container"));
        videoContainer.setId(ContentTree.VIDEO_ID);
        videoContainer.setParentID(ContentTree.ROOT_ID);
        videoContainer.setTitle("Videos");
        videoContainer.setRestricted(true);
        videoContainer.setWriteStatus(WriteStatus.NOT_WRITABLE);
        videoContainer.setChildCount(0);

        rootNode.getContainer().addContainer(videoContainer);
        rootNode.getContainer().setChildCount(
                rootNode.getContainer().getChildCount() + 1);
        ContentTree.addNode(ContentTree.VIDEO_ID, new ContentNode(
                ContentTree.VIDEO_ID, videoContainer));

        Cursor cursor = context.getContentResolver()
                .query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
                        null, null, null, null);
        if (cursor == null) {
            return;
        }
        while (cursor.moveToNext()) {
            String id = ContentTree.VIDEO_PREFIX
                    + cursor.getInt(cursor.getColumnIndex(MediaStore.Video.Media._ID));
            String title = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.TITLE));
            String creator = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST));
            String filePath = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.DATA));
            String mimeType = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE));
            long size = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.SIZE));
            long duration = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.DURATION));
            String resolution = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Video.Media.RESOLUTION));
            Res res = new Res(new MimeType(mimeType.substring(0, mimeType.indexOf('/')),
                    mimeType.substring(mimeType.indexOf('/') + 1)), size,
                    "http://" + address + "/" + id);
            res.setDuration(duration / (1000 * 60 * 60) + ":"
                    + (duration % (1000 * 60 * 60)) / (1000 * 60) + ":"
                    + (duration % (1000 * 60)) / 1000);
            res.setResolution(resolution);

            VideoItem videoItem = new VideoItem(id, ContentTree.VIDEO_ID, title, creator, res);
            videoContainer.addItem(videoItem);
            videoContainer.setChildCount(videoContainer.getChildCount() + 1);
            ContentTree.addNode(id, new ContentNode(id, videoItem, filePath));

//            Log.d(TAG, "added video item " + title + "from " + filePath);
        }

        cursor.close();
    }
 
开发者ID:hezhubo,项目名称:HPlayer,代码行数:62,代码来源:GenerateContentTask.java

示例5: replaceGenericItems

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
protected List<Item> replaceGenericItems(List<Item> genericItems) {
    List<Item> specificItems = new ArrayList();

    for (Item genericItem : genericItems) {
        String genericType = genericItem.getClazz().getValue();

        if (AudioItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new AudioItem(genericItem));
        } else if (MusicTrack.CLASS.getValue().equals(genericType)) {
            specificItems.add(new MusicTrack(genericItem));
        } else if (AudioBook.CLASS.getValue().equals(genericType)) {
            specificItems.add(new AudioBook(genericItem));
        } else if (AudioBroadcast.CLASS.getValue().equals(genericType)) {
            specificItems.add(new AudioBroadcast(genericItem));

        } else if (VideoItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new VideoItem(genericItem));
        } else if (Movie.CLASS.getValue().equals(genericType)) {
            specificItems.add(new Movie(genericItem));
        } else if (VideoBroadcast.CLASS.getValue().equals(genericType)) {
            specificItems.add(new VideoBroadcast(genericItem));
        } else if (MusicVideoClip.CLASS.getValue().equals(genericType)) {
            specificItems.add(new MusicVideoClip(genericItem));

        } else if (ImageItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new ImageItem(genericItem));
        } else if (Photo.CLASS.getValue().equals(genericType)) {
            specificItems.add(new Photo(genericItem));

        } else if (PlaylistItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new PlaylistItem(genericItem));

        } else if (TextItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new TextItem(genericItem));

        } else {
            specificItems.add(genericItem);
        }
    }

    return specificItems;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:43,代码来源:DIDLContent.java

示例6: launchItem

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
@Override
public void launchItem(final IDIDLItem item)
{
	if (getAVTransportService() == null)
		return;

	DIDLObject obj = ((ClingDIDLItem) item).getObject();
	if (!(obj instanceof Item))
		return;

	Item upnpItem = (Item) obj;

	String type = "";
	if (upnpItem instanceof AudioItem)
		type = "audioItem";
	else if (upnpItem instanceof VideoItem)
		type = "videoItem";
	else if (upnpItem instanceof ImageItem)
		type = "imageItem";
	else if (upnpItem instanceof PlaylistItem)
		type = "playlistItem";
	else if (upnpItem instanceof TextItem)
		type = "textItem";

	// TODO genre && artURI
	final TrackMetadata trackMetadata = new TrackMetadata(upnpItem.getId(), upnpItem.getTitle(),
			upnpItem.getCreator(), "", "", upnpItem.getFirstResource().getValue(),
			"object.item." + type);

	Log.i(TAG, "TrackMetadata : "+trackMetadata.toString());

	// Stop playback before setting URI
	controlPoint.execute(new Stop(getAVTransportService()) {
		@Override
		public void success(ActionInvocation invocation)
		{
			Log.v(TAG, "Success stopping ! ");
			callback();
		}

		@Override
		public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2)
		{
			Log.w(TAG, "Fail to stop ! " + arg2);
			callback();
		}

		public void callback()
		{
			setURI(item.getURI(), trackMetadata);
		}
	});

}
 
开发者ID:trishika,项目名称:DroidUPnP,代码行数:55,代码来源:RendererCommand.java

示例7: ClingVideoItem

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
public ClingVideoItem(VideoItem item)
{
	super(item);
}
 
开发者ID:trishika,项目名称:DroidUPnP,代码行数:5,代码来源:ClingVideoItem.java

示例8: getContainers

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
@Override
public List<Container> getContainers()
{
	String[] columns = {
		MediaStore.Video.Media._ID,
		MediaStore.Video.Media.TITLE,
		MediaStore.Video.Media.DATA,
		MediaStore.Video.Media.ARTIST,
		MediaStore.Video.Media.MIME_TYPE,
		MediaStore.Video.Media.SIZE,
		MediaStore.Video.Media.DURATION,
		MediaStore.Images.Media.HEIGHT,
		MediaStore.Images.Media.WIDTH,
	};

	Cursor cursor = ctx.getContentResolver().query(uri, columns, where, whereVal, orderBy);
	if(cursor!=null)
	{
		if (cursor.moveToFirst())
		{
			do
			{
				String id = ContentDirectoryService.VIDEO_PREFIX + cursor.getInt(cursor.getColumnIndex(MediaStore.Video.Media._ID));
				String title = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.TITLE));
				String creator = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST));
				String filePath = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA));
				String mimeType = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE));
				long size = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.SIZE));
				long duration = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DURATION));
				long height = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.HEIGHT));
				long width = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.WIDTH));

				String extension = "";
				int dot = filePath.lastIndexOf('.');
				if (dot >= 0)
					extension = filePath.substring(dot).toLowerCase();

				Res res = new Res(new MimeType(mimeType.substring(0, mimeType.indexOf('/')),
					mimeType.substring(mimeType.indexOf('/') + 1)), size, "http://" + baseURL + "/" + id + extension);
				res.setDuration(duration / (1000 * 60 * 60) + ":"
					+ (duration % (1000 * 60 * 60)) / (1000 * 60) + ":"
					+ (duration % (1000 * 60)) / 1000);
				res.setResolution((int) width, (int) height);

				addItem(new VideoItem(id, parentID, title, creator, res));

				Log.v(TAG, "Added video item " + title + " from " + filePath);

			} while (cursor.moveToNext());
		}
		cursor.close();
	}

	return containers;
}
 
开发者ID:trishika,项目名称:DroidUPnP,代码行数:56,代码来源:VideoContainer.java

示例9: playVideo

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
private void playVideo(VideoItem item) {
	Res res = item.getFirstResource();
	Uri uri = Uri.parse(res.getValue());

	MediaUtils.playVideo(getActivity(), uri);
}
 
开发者ID:msafin,项目名称:wmc,代码行数:7,代码来源:DlnaDetailFragment.java

示例10: isVideo

import org.fourthline.cling.support.model.item.VideoItem; //导入依赖的package包/类
public static boolean isVideo(DIDLObject object){
	return object instanceof VideoItem;
}
 
开发者ID:msafin,项目名称:wmc,代码行数:4,代码来源:Utils.java


注:本文中的org.fourthline.cling.support.model.item.VideoItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。