本文整理汇总了Java中org.videolan.libvlc.IVLCVout.setSubtitlesView方法的典型用法代码示例。如果您正苦于以下问题:Java IVLCVout.setSubtitlesView方法的具体用法?Java IVLCVout.setSubtitlesView怎么用?Java IVLCVout.setSubtitlesView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.videolan.libvlc.IVLCVout
的用法示例。
在下文中一共展示了IVLCVout.setSubtitlesView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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));
}