• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MediaList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onEvent

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
@Override
public void onEvent(MediaList.Event event) {
    if (mEventListener == null)
        return;
    final MediaList.Event mlEvent = event;

    switch (mlEvent.type) {
    case MediaList.Event.ItemAdded:
        mEventListener.onMediaAdded(mlEvent.index, mlEvent.media);
        break;
    case MediaList.Event.ItemDeleted:
        mEventListener.onMediaRemoved(mlEvent.index, mlEvent.media);
        break;
    case MediaList.Event.EndReached:
        mEventListener.onBrowseEnd();
    }
}
 
开发者ID:pedroSG94,项目名称:vlc-example-streamplayer,代码行数:18,代码来源:MediaBrowser.java


示例2: onEvent

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
@Override
public void onEvent(MediaList.Event event) {
    if (mEventListener == null)
        return;
    final MediaList.Event mlEvent = event;

    switch (mlEvent.type) {
        case MediaList.Event.ItemAdded:
            mEventListener.onMediaAdded(mlEvent.index, mlEvent.media);
            break;
        case MediaList.Event.ItemDeleted:
            mEventListener.onMediaRemoved(mlEvent.index, mlEvent.media);
            break;
        case MediaList.Event.EndReached:
            mEventListener.onBrowseEnd();
    }
}
 
开发者ID:SteinerOk,项目名称:libvlc-sdk-android,代码行数:18,代码来源:MediaBrowser.java


示例3: onEvent

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
@Override
public void onEvent(MediaList.Event event) {
    if (mEventListener == null)
        return;
    final MediaList.Event mlEvent = (MediaList.Event) event;

    /*
     * We use an intermediate array here since more than one MediaDiscoverer can be used
     */
    switch (mlEvent.type) {
    case MediaList.Event.ItemAdded:
        mEventListener.onMediaAdded(mlEvent.index, mlEvent.media);
        break;
    case MediaList.Event.ItemDeleted:
        mEventListener.onMediaRemoved(mlEvent.index, mlEvent.media);
        break;
    case MediaList.Event.EndReached:
        mEventListener.onBrowseEnd();
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:21,代码来源:MediaBrowser.java


示例4: expand

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
/**
 * Expand the current media.
 * @return the index of the media was expanded, and -1 if no media was expanded
 */
@MainThread
public int expand() {
    final Media media = mMediaPlayer.getMedia();
    if (media == null)
        return -1;
    final MediaList ml = media.subItems();
    media.release();
    int ret;

    if (ml.getCount() > 0) {
        mMediaList.remove(mCurrentIndex);
        for (int i = 0; i < ml.getCount(); ++i) {
            final Media child = ml.getMediaAt(i);
            child.parse();
            mMediaList.insert(mCurrentIndex, new MediaWrapper(child));
            child.release();
        }
        ret = 0;
    } else {
        ret = -1;
    }
    ml.release();
    return ret;
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:29,代码来源:PlaybackService.java


示例5: expand

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
/**
 * Expand the current media.
 * @return the index of the media was expanded, and -1 if no media was expanded
 */
@MainThread
public int expand() {
    final Media media = mMediaPlayer.getMedia();
    if (media == null)
        return -1;
    final MediaList ml = media.subItems();
    media.release();
    int ret;

    if (ml.getCount() > 0) {
        mMediaList.remove(mCurrentIndex);
        for (int i = ml.getCount() - 1; i >= 0; --i) {
            final Media child = ml.getMediaAt(i);
            child.parse();
            mMediaList.insert(mCurrentIndex, new MediaWrapper(child));
            child.release();
        }
        ret = 0;
    } else {
        ret = -1;
    }
    ml.release();
    return ret;
}
 
开发者ID:hanhailong,项目名称:VCL-Android,代码行数:29,代码来源:PlaybackService.java


示例6: onEvent

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
@Override
public void onEvent(VLCObject.Event event) {
    if (mEventListener == null)
        return;
    final MediaList.Event mlEvent = (MediaList.Event) event;

    /*
     * We use an intermediate array here since more than one MediaDiscoverer can be used
     */
    switch (mlEvent.type) {
    case MediaList.Events.MediaListItemAdded:
        mEventListener.onMediaAdded(mlEvent.index, mlEvent.media);
        break;
    case MediaList.Events.MediaListItemDeleted:
        mEventListener.onMediaRemoved(mlEvent.index, mlEvent.media);
        break;
    case MediaList.Events.MediaListEndReached:
        mEventListener.onBrowseEnd();
    }
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:21,代码来源:MediaBrowser.java


示例7: startMediaDiscoverer

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
private void startMediaDiscoverer(String discovererName) {
    MediaDiscoverer md = new MediaDiscoverer(mLibVlc, discovererName);
    mMediaDiscoverers.add(md);
    final MediaList ml = md.getMediaList();
    ml.setEventListener(mDiscovererMediaListEventListener, mHandler);
    ml.release();
    md.start();
}
 
开发者ID:pedroSG94,项目名称:vlc-example-streamplayer,代码行数:9,代码来源:MediaBrowser.java


示例8: startMediaDiscoverer

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
private void startMediaDiscoverer(String discovererName) {
    MediaDiscoverer md = new MediaDiscoverer(mLibVlc, discovererName);
    mMediaDiscoverers.add(md);
    final MediaList ml = md.getMediaList();
    ml.setEventListener(mDiscovererMediaListEventListener);
    ml.release();
    md.start();
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:9,代码来源:MediaBrowser.java


示例9: startMediaDiscoverer

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
private void startMediaDiscoverer(String discovererName) {
    MediaDiscoverer md = new MediaDiscoverer(mLibVlc, discovererName);
    mMediaDiscoverers.add(md);
    final MediaList ml = md.getMediaList();
    ml.setEventListener(mDiscovererMediaListEventListener);
    md.start();
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:8,代码来源:MediaBrowser.java


示例10: getMedia

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
public static org.videolan.libvlc.Media getMedia(LibVLC vlc, String uri) throws ExoPlaybackException {
	System.out.println(">> ExoVlcUtil.getMedia() uri = " + uri);

	org.videolan.libvlc.Media media = new org.videolan.libvlc.Media(vlc, uri);

	boolean parsed = media.parse(org.videolan.libvlc.Media.Parse.FetchNetwork);
	media.release();
	System.out.println("ExoVlcUtil.getMedia() is parsed media=" + media.isParsed());
	System.out.println("ExoVlcUtil.getMedia() media duration =");

	MediaList mlist = media.subItems();
	System.out.println("ExoVlcUtil.getMedia() sub item =" + mlist);
	if (mlist != null) {
		System.out.println(">>> ExoVlcUtil.getMedia() parsed media subItems count : " + mlist.getCount());
		for (int i = 0; i < mlist.getCount(); i++) {
			System.out.println(">>> ExoVlcUtil.getMedia() parsed media subItems item (" + i + ") : "
					+ mlist.getMediaAt(i).getType() + " track count " + mlist.getMediaAt(i).getTrackCount());

		}
	}
	System.out.println(">>> ExoVlcUtil.getMedia() parsed media  dump tracks : " + media.getTrackCount());
	for (int i = 0; i < media.getTrackCount(); i++) {
		System.out.println(">>> ExoVlcUtil.getMedia() parsed media  track[" + i + "]:" + media.getTrack(i).type);

	}

	// try {
	// boolean hv =vlc.hasVideoTrack(uri);
	// System.out.println(">>> ExoVlcUtil.getMedia() HAS VDO="+hv);
	// } catch (IOException e) {
	// // TODO Auto-generated catch block
	// e.printStackTrace();
	// }
	//
	if (!parsed)
		throw new ExoPlaybackException("Unable to parse media " + uri);
	return media;
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:39,代码来源:ExoVlcUtil.java


示例11: createPlayer

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
/**
 * **********
 * Player
 * ***********
 */

private void createPlayer(String media) {
    releasePlayer();
    setupControls();
    try {
        if (media.length() > 0) {
            Toast toast = Toast.makeText(this, media, Toast.LENGTH_LONG);
            toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0,
                    0);
            toast.show();
        }

        // Create a new media player
        libvlc = LibVLC.getInstance();
        libvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
        libvlc.eventVideoPlayerActivityCreated(true);
        libvlc.setSubtitlesEncoding("");
        libvlc.setAout(LibVLC.AOUT_OPENSLES);
        libvlc.setTimeStretching(true);
        libvlc.setChroma("RV32");
        libvlc.setVerboseMode(true);
        LibVLC.restart(this);
        EventHandler.getInstance().addHandler(mHandler);
        holder.setFormat(PixelFormat.RGBX_8888);
        holder.setKeepScreenOn(true);
        MediaList list = libvlc.getMediaList();
        list.clear();
        list.add(new Media(libvlc, LibVLC.PathToURI(media)), false);
        libvlc.playIndex(0);
    } catch (Exception e) {
        Toast.makeText(this, "Could not create Vlc Player", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:wass08,项目名称:VLC-Simple-Player-Android,代码行数:39,代码来源:FullscreenVlcPlayer.java


示例12: createPlayer

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
/*************
 * Player
 *************/

private void createPlayer(String media) {
    releasePlayer();
    try {
        if (media.length() > 0) {
            Toast toast = Toast.makeText(this, media, Toast.LENGTH_LONG);
            toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0,
                    0);
            toast.show();
        }

        // Create a new media player
        mLibvlc = LibVLC.getInstance();
        mLibvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_DECODING);
        mLibvlc.setAout(LibVLC.AOUT_OPENSLES);
        mLibvlc.setTimeStretching(true);
        mLibvlc.setChroma("RV32");
        mLibvlc.setVerboseMode(false);
        // LibVLC.restart(this);
        mLibvlc.init(this);
        EventHandler.getInstance().addHandler(mHandler);
        mHolder.setFormat(PixelFormat.RGBX_8888);
        mHolder.setKeepScreenOn(true);
        MediaList list = mLibvlc.getMediaList();
        list.clear();
        list.add(new Media(mLibvlc, media));
        mLibvlc.playIndex(0);
    } catch (Exception e) {
        Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG)
                .show();
        Log.d(TAG, "Create Player Exception:" + e.toString());
    }
}
 
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:37,代码来源:VideoActivity.java


示例13: load

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
/**
 * Loads a selection of files (a non-user-supplied collection of media)
 * into the primary or "currently playing" playlist.
 *
 * @param mediaPathList A list of locations to load
 * @param position The position to start playing at
 * @param noVideo True to disable video, false otherwise
 * @throws RemoteException
 */
@Override
public void load(List<String> mediaPathList, int position, boolean noVideo)
        throws RemoteException {

    Log.v(TAG, "Loading position " + ((Integer)position).toString() + " in " + mediaPathList.toString());
    mEventHandler.addHandler(mVlcEventHandler);

    mLibVLC.getMediaList().getEventHandler().removeHandler(mListEventHandler);
    mLibVLC.setMediaList();
    mLibVLC.getPrimaryMediaList().clear();
    MediaList mediaList = mLibVLC.getMediaList();

    mPrevious.clear();

    MediaDatabase db = MediaDatabase.getInstance();
    for (int i = 0; i < mediaPathList.size(); i++) {
        String location = mediaPathList.get(i);
        Media media = db.getMedia(location);
        if(media == null) {
            if(!validateLocation(location)) {
                Log.w(TAG, "Invalid location " + location);
                showToast(getResources().getString(R.string.invalid_location, location), Toast.LENGTH_SHORT);
                continue;
            }
            Log.v(TAG, "Creating on-the-fly Media object for " + location);
            media = new Media(mLibVLC, location);
        }
        mediaList.add(media, noVideo);
    }

    if (mLibVLC.getMediaList().size() == 0) {
        Log.w(TAG, "Warning: empty media list, nothing to play !");
        return;
    }
    if (mLibVLC.getMediaList().size() > position && position >= 0) {
        mCurrentIndex = position;
    } else {
        Log.w(TAG, "Warning: positon " + position + " out of bounds");
        mCurrentIndex = 0;
    }

    // Add handler after loading the list
    mLibVLC.getMediaList().getEventHandler().addHandler(mListEventHandler);

    mLibVLC.playIndex(mCurrentIndex);
    mHandler.sendEmptyMessage(SHOW_PROGRESS);
    setUpRemoteControlClient();
    showNotification();
    updateWidget(AudioService.this);
    updateRemoteControlClientMetadata();
    AudioService.this.saveMediaList();
    AudioService.this.saveCurrentMedia();
    determinePrevAndNextIndices();
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:64,代码来源:AudioService.java


示例14: load

import org.videolan.libvlc.MediaList; //导入依赖的package包/类
/**
 * Loads a selection of files (a non-user-supplied collection of media)
 * into the primary or "currently playing" playlist.
 *
 * @param mediaPathList A list of locations to load
 * @param position The position to start playing at
 * @param noVideo True to disable video, false otherwise
 * @throws RemoteException
 */
@Override
public void load(List<String> mediaPathList, int position, boolean noVideo)
        throws RemoteException {

    Log.v(TAG, "Loading position " + ((Integer)position).toString() + " in " + mediaPathList.toString());
    mEventHandler.addHandler(mVlcEventHandler);

    mLibVLC.getMediaList().getEventHandler().removeHandler(mListEventHandler);
    mLibVLC.setMediaList();
    mLibVLC.getPrimaryMediaList().clear();
    MediaList mediaList = mLibVLC.getMediaList();

    mPrevious.clear();

    MediaDatabase db = MediaDatabase.getInstance(AudioService.this);
    for (int i = 0; i < mediaPathList.size(); i++) {
        String location = mediaPathList.get(i);
        Media media = db.getMedia(location);
        if(media == null) {
            if(!validateLocation(location)) {
                Log.w(TAG, "Invalid location " + location);
                showToast(getResources().getString(R.string.invalid_location, location), Toast.LENGTH_SHORT);
                continue;
            }
            Log.v(TAG, "Creating on-the-fly Media object for " + location);
            media = new Media(mLibVLC, location);
        }
        mediaList.add(media, noVideo);
    }

    if (mLibVLC.getMediaList().size() == 0) {
        Log.w(TAG, "Warning: empty media list, nothing to play !");
        return;
    }
    if (mLibVLC.getMediaList().size() > position && position >= 0) {
        mCurrentIndex = position;
    } else {
        Log.w(TAG, "Warning: positon " + position + " out of bounds");
        mCurrentIndex = 0;
    }

    // Add handler after loading the list
    mLibVLC.getMediaList().getEventHandler().addHandler(mListEventHandler);

    mLibVLC.playIndex(mCurrentIndex);
    mHandler.sendEmptyMessage(SHOW_PROGRESS);
    setUpRemoteControlClient();
    showNotification();
    updateWidget(AudioService.this);
    updateRemoteControlClientMetadata();
    AudioService.this.saveMediaList();
    AudioService.this.saveCurrentMedia();
    determinePrevAndNextIndices();
}
 
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:64,代码来源:AudioService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MetaStoreUtils类代码示例发布时间:2022-05-21
下一篇:
Java HashedMap类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap