本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
}
示例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());
}
}
示例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();
}
示例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();
}