本文整理汇总了Java中org.videolan.libvlc.IVLCVout类的典型用法代码示例。如果您正苦于以下问题:Java IVLCVout类的具体用法?Java IVLCVout怎么用?Java IVLCVout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IVLCVout类属于org.videolan.libvlc包,在下文中一共展示了IVLCVout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlayer
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
private void createPlayer() {
releasePlayer();
String videoLink = UniversalPlayer.getInstance().getPlayingMediaItem().getAudeoLink();
try {
Logger.printInfo(TAG, "Trying to play video: " + videoLink);
ArrayList<String> options = new ArrayList<String>();
options.add("--aout=opensles");
options.add("--audio-time-stretch"); // time stretching
options.add("-vvv"); // verbosity
libvlc = new LibVLC(options);
shVideoHolder.setKeepScreenOn(true);
// Create media player
mMediaPlayer = new MediaPlayer(libvlc);
mMediaPlayer.setEventListener(this);
// Set up video output
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.setVideoView(sfVideo);
vout.addCallback(this);
vout.attachViews();
Media m = URLUtil.isValidUrl(videoLink) ? new Media(libvlc, Uri.parse(videoLink)) : new Media(libvlc, videoLink);
mMediaPlayer.setMedia(m);
mMediaPlayer.play();
} catch (Exception e) {
Logger.printInfo(TAG, "Error creating video player: ");
e.printStackTrace();
if (onPlayingFailedCallback != null) {
onPlayingFailedCallback.operationFinished();
}
}
}
示例2: releasePlayer
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
private void releasePlayer() {
if (libvlc == null)
return;
mMediaPlayer.stop();
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.removeCallback(this);
vout.detachViews();
shVideoHolder = null;
libvlc.release();
libvlc = null;
mVideoWidth = 0;
mVideoHeight = 0;
isVideoPlayerReady = false;
if (rlVideoControls != null && btnPlay != null) {
rlVideoControls.setVisibility(View.GONE);
btnPlay.setVisibility(View.GONE);
}
}
示例3: releasePlayer
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
private void releasePlayer() {
if (libvlc == null) return;
Task.callInBackground(new Callable<Void>() {
@Override
public Void call() throws Exception {
mMediaPlayer.stop();
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.removeCallback(ReactVideoView.this);
vout.detachViews();
libvlc.release();
libvlc = null;
return null;
}
});
}
示例4: onNewLayout
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
/**
* This callback is called when the native vout call request a new Layout.
*
* @param vlcVout vlcVout
* @param width Frame width
* @param height Frame height
* @param visibleWidth Visible frame width
* @param visibleHeight Visible frame height
* @param sarNum Surface aspect ratio numerator
* @param sarDen Surface aspect ratio denominator
*/
@Override
public void onNewLayout(
IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
if (width * height <= 0) {
return;
}
// store video size
mVideoWidth = width;
mVideoHeight = height;
mVideoVisibleWidth = visibleWidth;
mVideoVisibleHeight = visibleHeight;
mSarNum = sarNum;
mSarDen = sarDen;
changeSurfaceLayout();
}
示例5: onStart
import org.videolan.libvlc.IVLCVout; //导入依赖的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);
}
示例6: createPlayer
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
private void createPlayer(String mediaUrl) {
releasePlayer();
if(mediaUrl.isEmpty()) return;
try {
// Create LibVLC
mLibvlc = new LibVLC();
// Create media player
mMediaPlayer = new MediaPlayer(mLibvlc);
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.setVideoView(mSurfaceView);
vout.addCallback(this);
vout.attachViews();
final Media media = new Media(mLibvlc, Uri.parse(mediaUrl));
mMediaPlayer.setMedia(media);
mMediaPlayer.setEventListener(listener);
//media.release();
if(mIsPlaying) {
startPlayer();
}
} catch (Exception e) {
Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG).show();
}
}
示例7: onNewLayout
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
@Override
public void onNewLayout(IVLCVout vout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
mVideoWidth = width;
mVideoHeight = height;
mVideoVisibleWidth = visibleWidth;
mVideoVisibleHeight = visibleHeight;
mSarNum = sarNum;
mSarDen = sarDen;
changeSurfaceLayout();
}
示例8: setMedia
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
private void setMedia(Media media) {
//delay = network buffer + file buffer
//media.addOption(":network-caching=" + Constants.BUFFER);
//media.addOption(":file-caching=" + Constants.BUFFER);
media.addOption(":fullscreen");
media.setHWDecoderEnabled(true, false);
player = new MediaPlayer(vlcInstance);
player.setMedia(media);
player.setEventListener(this);
IVLCVout vlcOut = player.getVLCVout();
//set correct class for render depend of constructor called
if (surfaceView != null) {
vlcOut.setVideoView(surfaceView);
width = surfaceView.getWidth();
height = surfaceView.getHeight();
} else if (textureView != null) {
vlcOut.setVideoView(textureView);
width = textureView.getWidth();
height = textureView.getHeight();
} else if (surfaceTexture != null) {
vlcOut.setVideoSurface(surfaceTexture);
} else if (surface != null) {
vlcOut.setVideoSurface(surface, surfaceHolder);
} else {
throw new RuntimeException("You cant set a null render object");
}
if (width != 0 && height != 0) vlcOut.setWindowSize(width, height);
vlcOut.attachViews();
player.setVideoTrackEnabled(true);
player.play();
}
示例9: createPlayer
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
/**
* Creates MediaPlayer and plays video
*
* @param media
*/
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 LibVLC
// TODO: make this more robust, and sync with audio demo
ArrayList<String> options = new ArrayList<String>();
//options.add("--subsdec-encoding <encoding>");
options.add("--aout=opensles");
options.add("--audio-time-stretch"); // time stretching
options.add("-vvv"); // verbosity
libvlc = new LibVLC(this, options);
holder.setKeepScreenOn(true);
// Creating media player
mMediaPlayer = new MediaPlayer(libvlc);
mMediaPlayer.setEventListener(mPlayerListener);
// Seting up video output
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.setVideoView(mSurface);
//vout.setSubtitlesView(mSurfaceSubtitles);
vout.addCallback(this);
vout.attachViews();
Media m = new Media(libvlc, Uri.parse(media));
mMediaPlayer.setMedia(m);
mMediaPlayer.play();
} catch (Exception e) {
Toast.makeText(this, "Error in creating player!", Toast
.LENGTH_LONG).show();
}
}
示例10: releasePlayer
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
private void releasePlayer() {
if (libvlc == null)
return;
mMediaPlayer.stop();
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.removeCallback(this);
vout.detachViews();
holder = null;
libvlc.release();
libvlc = null;
mVideoWidth = 0;
mVideoHeight = 0;
}
示例11: onNewLayout
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
@Override
public void onNewLayout(IVLCVout vout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
if (width * height == 0)
return;
// store video size
mVideoWidth = width;
mVideoHeight = height;
setSize(mVideoWidth, mVideoHeight);
}
示例12: onNewLayout
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
@Override
public void onNewLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
if (width * height == 0)
return;
// store video size
mVideoWidth = width;
mVideoHeight = height;
setSize(mVideoWidth, mVideoHeight);
}
示例13: onHardwareAccelerationError
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
@Override
public void onHardwareAccelerationError(IVLCVout vlcVout) {
// Handle errors with hardware acceleration
Logger.printError(TAG, "Error with hardware acceleration");
this.releasePlayer();
if (onPlayingFailedCallback != null) {
onPlayingFailedCallback.operationFinished();
}
}
示例14: vlcSetSurface
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
public void vlcSetSurface(Surface surface){
// Set up video output
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.setVideoSurface(surface, null);
//vout.setSubtitlesView(mSurfaceSubtitles);
vout.addCallback(this);
vout.attachViews();
}
示例15: releasePlayer
import org.videolan.libvlc.IVLCVout; //导入依赖的package包/类
private void releasePlayer() {
if (libvlc == null)
return;
mMediaPlayer.stop();
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.removeCallback(this);
vout.detachViews();
libvlc.release();
libvlc = null;
}