本文整理汇总了Java中org.videolan.libvlc.EventHandler类的典型用法代码示例。如果您正苦于以下问题:Java EventHandler类的具体用法?Java EventHandler怎么用?Java EventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventHandler类属于org.videolan.libvlc包,在下文中一共展示了EventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDestroy
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(mReceiver);
EventHandler em = EventHandler.getInstance();
em.removeHandler(eventHandler);
// MediaCodec opaque direct rendering should not be used anymore since there is no surface to attach.
mLibVLC.eventVideoPlayerActivityCreated(false);
// HW acceleration was temporarily disabled because of an error, restore the previous value.
if (mDisabledHardwareAcceleration)
mLibVLC.setHardwareAcceleration(mPreviousHardwareAccelerationMode);
mAudioManager = null;
}
示例2: handleMessage
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
FullscreenVlcPlayer player = mOwner.get();
// Player events
if (msg.what == VideoSizeChanged) {
player.setSize(msg.arg1, msg.arg2);
return;
}
// Libvlc events
Bundle b = msg.getData();
switch (b.getInt("event")) {
case EventHandler.MediaPlayerEndReached:
player.releasePlayer();
break;
case EventHandler.MediaPlayerPlaying:
case EventHandler.MediaPlayerPaused:
case EventHandler.MediaPlayerStopped:
default:
break;
}
}
示例3: handleMessage
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
HistoryAdapter adapater = getOwner();
if(adapater == null) return;
String item_uri = msg.getData().getString("item_uri");
int item_index = msg.getData().getInt("item_index");
switch (msg.getData().getInt("event")) {
case EventHandler.CustomMediaListItemAdded:
adapater.updateEvent(true, item_uri, item_index);
break;
case EventHandler.CustomMediaListItemDeleted:
adapater.updateEvent(false, item_uri, item_index);
break;
}
}
示例4: setRemoteControlClientPlaybackState
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
/**
* A function to control the Remote Control Client. It is needed for
* compatibility with devices below Ice Cream Sandwich (4.0).
*
* @param p Playback state
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setRemoteControlClientPlaybackState(int state) {
if (!LibVlcUtil.isICSOrLater() || mRemoteControlClient == null)
return;
switch (state) {
case EventHandler.MediaPlayerPlaying:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
break;
case EventHandler.MediaPlayerPaused:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED);
break;
case EventHandler.MediaPlayerStopped:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
break;
}
}
示例5: setRemoteControlClientPlaybackState
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
/**
* A function to control the Remote Control Client. It is needed for
* compatibility with devices below Ice Cream Sandwich (4.0).
*
* @param p Playback state
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setRemoteControlClientPlaybackState(int state) {
if(!Util.isICSOrLater() || mRemoteControlClient == null)
return;
switch (state) {
case EventHandler.MediaPlayerPlaying:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
break;
case EventHandler.MediaPlayerPaused:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED);
break;
case EventHandler.MediaPlayerStopped:
mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
break;
}
}
示例6: handleMessage
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
VideoActivity player = mOwner.get();
// SamplePlayer events
if (msg.what == VideoSizeChanged) {
Log.d(TAG, "Video Size Changed:" + msg.arg1 + " " + msg.arg2);
player.setSize(msg.arg1, msg.arg2);
return;
}
// Libvlc events
Bundle b = msg.getData();
switch (b.getInt("event")) {
case EventHandler.MediaPlayerEndReached:
player.releasePlayer();
break;
case EventHandler.MediaPlayerPlaying:
case EventHandler.MediaPlayerPaused:
case EventHandler.MediaPlayerStopped:
default:
break;
}
}
示例7: releasePlayer
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
private void releasePlayer() {
if (libvlc == null)
return;
Thread.dumpStack();
EventHandler.getInstance(). removeHandler(mHandler);
libvlc.stop();
libvlc = null;
mVideoWidth = 0;
mVideoHeight = 0;
}
示例8: handleMessage
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
VideoActivity player = mOwner.get();
// SamplePlayer events
if (msg.what == VideoSizeChanged) {
// player.setSize(msg.arg1, msg.arg2);
player.changeSurfaceLayout();
return;
}
// Libvlc events
Bundle b = msg.getData();
switch (b.getInt("event")) {
case EventHandler.MediaPlayerEndReached:
System.out.println(">>> VideoActivity.MyHandler.handleMessage():::MediaPlayerEndReached");
Log.d(TAG, "MediaPlayerEndReached");
player.releasePlayer();
break;
case EventHandler.MediaPlayerPlaying:
case EventHandler.MediaPlayerPaused:
case EventHandler.MediaPlayerStopped:
default:
break;
}
}
示例9: createPlayer
import org.videolan.libvlc.EventHandler; //导入依赖的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();
}
}
示例10: releasePlayer
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
private void releasePlayer() {
if (handlerSeekbar != null && runnableSeekbar != null)
handlerSeekbar.removeCallbacks(runnableSeekbar);
EventHandler.getInstance().removeHandler(mHandler);
if (libvlc == null)
return;
libvlc.stop();
libvlc.detachSurface();
holder = null;
libvlc.closeAout();
mVideoWidth = 0;
mVideoHeight = 0;
}
示例11: HistoryAdapter
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
public HistoryAdapter(Context context) {
mInflater = LayoutInflater.from(context);
try {
mLibVLC = LibVLC.getInstance();
} catch (LibVlcException e) {
Log.d(TAG, "LibVlcException encountered in HistoryAdapter", e);
return;
}
EventHandler em = mLibVLC.getPrimaryMediaList().getEventHandler();
em.addHandler(new HistoryEventHandler(this));
}
示例12: stop
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
private void stop() {
mLibVLC.stop();
mEventHandler.removeHandler(mVlcEventHandler);
mLibVLC.getMediaList().getEventHandler().removeHandler(mListEventHandler);
setRemoteControlClientPlaybackState(EventHandler.MediaPlayerStopped);
mCurrentIndex = -1;
mPrevious.clear();
mHandler.removeMessages(SHOW_PROGRESS);
hideNotification();
executeUpdate();
executeUpdateProgress();
changeAudioFocus(false);
}
示例13: HistoryAdapter
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
public HistoryAdapter() {
mInflater = LayoutInflater.from(VLCApplication.getAppContext());
try {
mLibVLC = LibVLC.getInstance();
} catch (LibVlcException e) {
Log.d(TAG, "LibVlcException encountered in HistoryAdapter", e);
return;
}
EventHandler em = mLibVLC.getPrimaryMediaList().getEventHandler();
em.addHandler(new HistoryEventHandler(this));
}
示例14: onDestroy
import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
protected void onDestroy() {
Log.d("lifeCycleVPA", "onDestroy");
super.onDestroy();
unregisterReceiver(mReceiver);
EventHandler em = EventHandler.getInstance();
em.removeHandler(eventHandler);
mAudioManager = null;
// TRIBLER
initCompleted = false;
metaDataDone = false;
seekBufferCompleted = false;
inMetaDataWait = false;
magnet = false;
torrentFile = false;
if (!contentName.isEmpty()) {
libTorrent().RemoveTorrent(contentName);
}
libTorrent().AbortSession();
asyncTaskRunning.remove("main");
// delete libTorrent instance
deleteLibTorrent();
}
示例15: createPlayer
import org.videolan.libvlc.EventHandler; //导入依赖的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());
}
}