本文整理汇总了Java中org.videolan.libvlc.Media.release方法的典型用法代码示例。如果您正苦于以下问题:Java Media.release方法的具体用法?Java Media.release怎么用?Java Media.release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.videolan.libvlc.Media
的用法示例。
在下文中一共展示了Media.release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStart
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
final IVLCVout vlcVout = mMediaPlayer.getVLCVout();
// final IVLCVout vlcVout2 = mMediaPlayer2.getVLCVout();
vlcVout.setVideoView(mVideoSurface);
// vlcVout2.setVideoView(mVideoSurface1);
vlcVout.attachViews();
// vlcVout2.attachViews();
mMediaPlayer.getVLCVout().addCallback(this);
// mMediaPlayer2.getVLCVout().addCallback(this);
Media media = new Media(mLibVLC, Uri.parse(SAMPLE_URL));
// Media media1 = new Media(mLibVLC, Uri.parse(SAMPLE_URL1));
mMediaPlayer.setMedia(media);
// mMediaPlayer2.setMedia(media1);
media.release();
mMediaPlayer.play();
// mMediaPlayer2.play();
// mMediaPlayer.setRate(.5f);
}
示例2: expand
import org.videolan.libvlc.Media; //导入方法依赖的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;
}
示例3: stop
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
@MainThread
public void stop() {
if (mMediaPlayer == null)
return;
savePosition();
final Media media = mMediaPlayer.getMedia();
if (media != null) {
media.setEventListener(null);
mMediaPlayer.setEventListener(null);
mMediaPlayer.stop();
mMediaPlayer.setMedia(null);
media.release();
}
mMediaList.removeEventListener(mListEventListener);
setRemoteControlClientPlaybackState(MediaPlayer.Event.Stopped);
mCurrentIndex = -1;
mPrevious.clear();
mHandler.removeMessages(SHOW_PROGRESS);
hideNotification();
broadcastMetadata();
executeUpdate();
executeUpdateProgress();
changeAudioFocus(false);
}
示例4: browse
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Browse to the specified local path starting with '/'.
*
* @param path
* @param flags see {@link Flag}
*/
@MainThread
public void browse(String path, int flags) {
final Media media = new Media(mLibVlc, path);
browse(media, flags);
media.release();
}
示例5: getThumbnail
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Get a media thumbnail.
* @return a bytearray with the RGBA thumbnail data inside.
*/
public static byte[] getThumbnail(LibVLC libVLC, Uri uri, int i_width, int i_height) {
/* dvd thumbnails can work only with dvdsimple demux */
if (uri.getLastPathSegment().endsWith(".iso"))
uri = Uri.parse("dvdsimple://" + uri.getEncodedPath());
final Media media = new Media(libVLC, uri);
byte[] bytes = getThumbnail(media, i_width, i_height);
media.release();
return bytes;
}
示例6: Dumper
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Create a Dumper that will download an Uri into a local filesystem path
* @param uri the Uri to dump
* @param filepath local filesystem path where to dump the Uri
* @param listener listener in order to be notified when the dump is finished
*/
@MainThread
public Dumper(Uri uri, String filepath, Listener listener) {
if (uri == null || filepath == null || listener == null)
throw new IllegalArgumentException("arguments shouldn't be null");
mListener = listener;
ArrayList<String> options = new ArrayList<>(8);
options.add("--demux");
options.add("dump2,none");
options.add("--demuxdump-file");
options.add(filepath);
options.add("--no-video");
options.add("--no-audio");
options.add("--no-spu");
options.add("-vv");
mLibVLC = new LibVLC(null, options);
final Media media = new Media(mLibVLC, uri);
mMediaPlayer = new MediaPlayer(media);
mMediaPlayer.setEventListener(new MediaPlayer.EventListener() {
@Override
public void onEvent(MediaPlayer.Event event) {
switch (event.type) {
case MediaPlayer.Event.Buffering:
mListener.onProgress(event.getBuffering());
break;
case MediaPlayer.Event.EncounteredError:
case MediaPlayer.Event.EndReached:
mListener.onFinish(event.type == MediaPlayer.Event.EndReached);
cancel();
break;
}
}
});
media.release();
}
示例7: getThumbnail
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Get a media thumbnail.
*
* @return a bytearray with the RGBA thumbnail data inside.
*/
public static byte[] getThumbnail(LibVLC libVLC, Uri uri, int i_width, int i_height) {
/* dvd thumbnails can work only with dvdsimple demux */
if (uri.getLastPathSegment().endsWith(".iso"))
uri = Uri.parse("dvdsimple://" + uri.getEncodedPath());
final Media media = new Media(libVLC, uri);
byte[] bytes = getThumbnail(media, i_width, i_height);
media.release();
return bytes;
}
示例8: Dumper
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Create a Dumper that will download an Uri into a local filesystem path
*
* @param uri the Uri to dump
* @param filepath local filesystem path where to dump the Uri
* @param listener listener in order to be notified when the dump is finished
*/
@MainThread
public Dumper(Uri uri, String filepath, Listener listener) {
if (uri == null || filepath == null || listener == null)
throw new IllegalArgumentException("arguments shouldn't be null");
mListener = listener;
ArrayList<String> options = new ArrayList<>(8);
options.add("--demux");
options.add("dump2,none");
options.add("--demuxdump-file");
options.add(filepath);
options.add("--no-video");
options.add("--no-audio");
options.add("--no-spu");
options.add("-vv");
mLibVLC = new LibVLC(null, options);
final Media media = new Media(mLibVLC, uri);
mMediaPlayer = new MediaPlayer(media);
mMediaPlayer.setEventListener(new MediaPlayer.EventListener() {
@Override
public void onEvent(MediaPlayer.Event event) {
switch (event.type) {
case MediaPlayer.Event.Buffering:
mListener.onProgress(event.getBuffering());
break;
case MediaPlayer.Event.EncounteredError:
case MediaPlayer.Event.EndReached:
mListener.onFinish(event.type == MediaPlayer.Event.EndReached);
cancel();
break;
}
}
});
media.release();
}
示例9: getThumbnail
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Get a media thumbnail.
* @return a bytearray with the RGBA thumbnail data inside.
*/
public static byte[] getThumbnail(LibVLC libVLC, Uri uri, int i_width, int i_height) {
final Media media = new Media(libVLC, uri);
byte[] bytes = getThumbnail(media, i_width, i_height);
media.release();
return bytes;
}
示例10: onStart
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
final IVLCVout vlcVout = mMediaPlayer.getVLCVout();
vlcVout.setVideoView(mVideoSurface);
vlcVout.attachViews();
mMediaPlayer.getVLCVout().addCallback(this);
Media media = new Media(mLibVLC, Uri.parse(SAMPLE_URL));
mMediaPlayer.setMedia(media);
media.release();
mMediaPlayer.play();
}
示例11: browse
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Browse to the specified local path starting with '/'.
*
* @param path
* @param flags see {@link MediaBrowser.Flag}
*/
@MainThread
public void browse(String path, int flags) {
final Media media = new Media(mLibVlc, path);
browse(media, flags);
media.release();
}
示例12: updateMeta
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
public void updateMeta(MediaPlayer mediaPlayer) {
final Media media = mediaPlayer.getMedia();
if (media == null)
return;
updateMeta(media);
media.release();
}
示例13: setContextMenuItems
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
private void setContextMenuItems(Menu menu, MediaWrapper mediaWrapper) {
long lastTime = mediaWrapper.getTime();
if (lastTime > 0)
menu.findItem(R.id.video_list_play_from_start).setVisible(true);
boolean hasInfo = false;
final Media media = new Media(VLCInstance.get(), mediaWrapper.getUri());
media.parse();
if (media.getMeta(Media.Meta.Title) != null)
hasInfo = true;
media.release();
menu.findItem(R.id.video_list_info).setVisible(hasInfo);
menu.findItem(R.id.video_list_delete).setVisible(!AndroidUtil.isLolliPopOrLater() ||
mediaWrapper.getLocation().startsWith("file://" + AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY));
}
示例14: playIndex
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
/**
* Play a media from the media list (playlist)
*
* @param index The index of the media
* @param flags LibVLC.MEDIA_* flags
*/
public void playIndex(int index, int flags) {
if (mMediaList.size() == 0) {
Log.w(TAG, "Warning: empty media list, nothing to play !");
return;
}
if (index >= 0 && index < mMediaList.size()) {
mCurrentIndex = index;
} else {
Log.w(TAG, "Warning: index " + index + " out of bounds");
mCurrentIndex = 0;
}
String mrl = mMediaList.getMRL(index);
if (mrl == null)
return;
final MediaWrapper mw = mMediaList.getMedia(index);
if (mw == null)
return;
final Media media = new Media(VLCInstance.get(), mw.getUri());
VLCOptions.setMediaOptions(media, this, flags | mw.getFlags());
media.setEventListener(mMediaListener);
mMediaPlayer.setMedia(media);
media.release();
mMediaPlayer.setEqualizer(VLCOptions.getEqualizer(this));
mMediaPlayer.setVideoTitleDisplay(MediaPlayer.Position.Disable, 0);
changeAudioFocus(true);
mMediaPlayer.setEventListener(mMediaPlayerListener);
mMediaPlayer.play();
notifyTrackChanged();
determinePrevAndNextIndices();
}
示例15: stop
import org.videolan.libvlc.Media; //导入方法依赖的package包/类
@MainThread
public void stop() {
if (mMediaSession != null) {
mMediaSession.setActive(false);
mMediaSession.release();
mMediaSession = null;
}
if (mMediaPlayer == null)
return;
savePosition();
final Media media = mMediaPlayer.getMedia();
if (media != null) {
media.setEventListener(null);
mMediaPlayer.setEventListener(null);
mMediaPlayer.stop();
mMediaPlayer.setMedia(null);
media.release();
}
mMediaList.removeEventListener(mListEventListener);
setRemoteControlClientPlaybackState(MediaPlayer.Event.Stopped);
mCurrentIndex = -1;
mPrevious.clear();
mHandler.removeMessages(SHOW_PROGRESS);
hideNotification();
broadcastMetadata();
executeUpdate();
executeUpdateProgress();
changeAudioFocus(false);
}