本文整理汇总了Java中org.videolan.libvlc.IVLCVout.setVideoView方法的典型用法代码示例。如果您正苦于以下问题:Java IVLCVout.setVideoView方法的具体用法?Java IVLCVout.setVideoView怎么用?Java IVLCVout.setVideoView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.videolan.libvlc.IVLCVout
的用法示例。
在下文中一共展示了IVLCVout.setVideoView方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: 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();
}
}
示例4: 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();
}
示例5: 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();
}
}
示例6: onHostResume
import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
@Override
public void onHostResume() {
if (mMediaPlayer != null) {
IVLCVout vout = mMediaPlayer.getVLCVout();
if (vout != null) {
if (!vout.areViewsAttached()) {
vout.setVideoView(this);
vout.attachViews();
}
}
}
}
示例7: onStart
import org.videolan.libvlc.IVLCVout; //导入方法依赖的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();
}
示例8: VlcMediaPlayer
import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
public VlcMediaPlayer(SurfaceView videoView, SurfaceView subtitlesView, List<String> libVlcOptions) {
super(createLibVlc(libVlcOptions));
LibVLC.setOnNativeCrashListener(nativeCrashListener);
setMaxPlayRate(64); // TODO pref
setEventListener(vlcEventListener);
// video output
final IVLCVout vout = getVLCVout();
vout.setVideoView(videoView);
if (subtitlesView != null)
vout.setSubtitlesView(subtitlesView);
vout.addCallback(nativeCallback);
vout.attachViews();
}
示例9: createPlayer
import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
/*************
* Player
*************/
private void createPlayer(String media) {
releasePlayer();
setupControls();
try {
final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
// Create LibVLC
// TODO: make this more robust, and sync with audio demo
ArrayList<String> options = new ArrayList<String>(50);
int deblocking = getDeblocking(-1);
int networkCaching = pref.getInt("network_caching_value", 0);
if (networkCaching > 60000)
networkCaching = 60000;
else if (networkCaching < 0)
networkCaching = 0;
//options.add("--subsdec-encoding <encoding>");
/* CPU intensive plugin, setting for slow devices */
options.add("--audio-time-stretch");
options.add("--avcodec-skiploopfilter");
options.add("" + deblocking);
options.add("--avcodec-skip-frame");
options.add("0");
options.add("--avcodec-skip-idct");
options.add("0");
options.add("--subsdec-encoding");
// options.add(subtitlesEncoding);
options.add("--stats");
/* XXX: why can't the default be fine ? #7792 */
if (networkCaching > 0)
options.add("--network-caching=" + networkCaching);
options.add("--androidwindow-chroma");
options.add("RV32");
options.add("-vv");
libvlc = new LibVLC(options);
holder.setKeepScreenOn(true);
// Create media player
mMediaPlayer = new MediaPlayer(libvlc);
holder.setFormat(PixelFormat.RGBX_8888);
holder.setKeepScreenOn(true);
mMediaPlayer.setEventListener(mPlayerListener);
// Set up video output
final IVLCVout vout = mMediaPlayer.getVLCVout();
if (!vout.areViewsAttached()) {
vout.setVideoView(mSurface);
vout.addCallback(this);
vout.attachViews();
}
//vout.setSubtitlesView(mSurfaceSubtitles);
Uri uri = Uri.parse(media);
Media m = new Media(libvlc, uri);
mMediaPlayer.setMedia(m);
mMediaPlayer.play();
} catch (Exception e) {
Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG).show();
}
}
示例10: startPlayback
import org.videolan.libvlc.IVLCVout; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void startPlayback() {
/* start playback only when audio service and both surfaces are ready */
if (mPlaybackStarted || mService == null)
return;
LibVLC().setOnHardwareAccelerationError(this);
final IVLCVout vlcVout = mService.getVLCVout();
if (mPresentation == null) {
vlcVout.setVideoView(mSurfaceView);
if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
vlcVout.setSubtitlesView(mSubtitlesSurfaceView);
} else {
vlcVout.setVideoView(mPresentation.mSurfaceView);
if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
vlcVout.setSubtitlesView(mPresentation.mSubtitlesSurfaceView);
}
vlcVout.addCallback(this);
vlcVout.attachViews();
mPlaybackStarted = true;
if (AndroidUtil.isHoneycombOrLater()) {
if (mOnLayoutChangeListener == null) {
mOnLayoutChangeListener = new View.OnLayoutChangeListener() {
private final Runnable mRunnable = new Runnable() {
@Override
public void run() {
changeSurfaceLayout();
}
};
@Override
public void onLayoutChange(View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) {
/* changeSurfaceLayout need to be called after the layout changed */
mHandler.removeCallbacks(mRunnable);
mHandler.post(mRunnable);
}
}
};
}
mSurfaceFrame.addOnLayoutChangeListener(mOnLayoutChangeListener);
}
changeSurfaceLayout();
if (mMediaRouter != null) {
// Listen for changes to media routes.
mediaRouterAddCallback(true);
}
loadMedia();
mSurfaceView.setKeepScreenOn(true);
// Add any selected subtitle file from the file picker
if(mSubtitleSelectedFiles.size() > 0) {
for(String file : mSubtitleSelectedFiles) {
Log.i(TAG, "Adding user-selected subtitle " + file);
mService.addSubtitleTrack(file);
}
}
// Set user playback speed
mService.setRate(mSettings.getFloat(PreferencesActivity.VIDEO_SPEED, 1));
}