当前位置: 首页>>代码示例>>Java>>正文


Java EventHandler类代码示例

本文整理汇总了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;
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:17,代码来源:VideoPlayerActivity.java

示例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;
    }
}
 
开发者ID:wass08,项目名称:VLC-Simple-Player-Android,代码行数:24,代码来源:FullscreenVlcPlayer.java

示例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;
    }
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:17,代码来源:HistoryAdapter.java

示例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;
    }
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:24,代码来源:AudioService.java

示例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;
    }
}
 
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:24,代码来源:AudioService.java

示例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;
    }
}
 
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:25,代码来源:VideoActivity.java

示例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;
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:13,代码来源:VideoActivity.java

示例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;
        }
    }
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:29,代码来源:VideoActivity.java

示例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();
    }
}
 
开发者ID:wass08,项目名称:VLC-Simple-Player-Android,代码行数:39,代码来源:FullscreenVlcPlayer.java

示例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;
}
 
开发者ID:wass08,项目名称:VLC-Simple-Player-Android,代码行数:15,代码来源:FullscreenVlcPlayer.java

示例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));
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:13,代码来源:HistoryAdapter.java

示例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);
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:14,代码来源:AudioService.java

示例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));
}
 
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:13,代码来源:HistoryAdapter.java

示例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();
}
 
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:29,代码来源:VideoPlayerActivity.java

示例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());
    }
}
 
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:37,代码来源:VideoActivity.java


注:本文中的org.videolan.libvlc.EventHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。