• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EventHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.videolan.libvlc.EventHandler的典型用法代码示例。如果您正苦于以下问题:Java EventHandler类的具体用法?Java EventHandler怎么用?Java EventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EventHandler类属于org.videolan.libvlc包,在下文中一共展示了EventHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: releasePlayer

import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
private void releasePlayer() {
    if (mLibvlc == null)
        return;
    EventHandler.getInstance().removeHandler(mHandler);
    mLibvlc.stop();
    mLibvlc.detachSurface();
    mHolder = null;
    mLibvlc.closeAout();
    mLibvlc.destroy();
    mLibvlc = null;

    mVideoWidth = 0;
    mVideoHeight = 0;
}
 
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:15,代码来源:VideoActivity.java


示例17: handleMessage

import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
    VideoPlayerActivity activity = getOwner();
    if(activity == null) return;
    // Do not handle events if we are leaving the VideoPlayerActivity
    if (activity.mSwitchingView) return;

    switch (msg.getData().getInt("event")) {
        case EventHandler.MediaParsedChanged:
            Log.i(TAG, "MediaParsedChanged");
            if (activity.mLibVLC.getVideoTracksCount() < 1) {
                Log.i(TAG, "No video track, open in audio mode");
                activity.switchToAudioMode();
            }
            break;
        case EventHandler.MediaPlayerPlaying:
            Log.i(TAG, "MediaPlayerPlaying");
            activity.stopLoadingAnimation();
            activity.showOverlay();
            /** FIXME: update the track list when it changes during the
             *  playback. (#7540) */
            activity.setESTrackLists(true);
            activity.setESTracks();
            activity.changeAudioFocus(true);
            break;
        case EventHandler.MediaPlayerPaused:
            Log.i(TAG, "MediaPlayerPaused");
            break;
        case EventHandler.MediaPlayerStopped:
            Log.i(TAG, "MediaPlayerStopped");
            activity.changeAudioFocus(false);
            break;
        case EventHandler.MediaPlayerEndReached:
            Log.i(TAG, "MediaPlayerEndReached");
            activity.changeAudioFocus(false);
            activity.endReached();
            break;
        case EventHandler.MediaPlayerVout:
            activity.handleVout(msg);
            break;
        case EventHandler.MediaPlayerPositionChanged:
            if (!activity.mCanSeek)
                activity.mCanSeek = true;
            //don't spam the logs
            break;
        case EventHandler.MediaPlayerEncounteredError:
            Log.i(TAG, "MediaPlayerEncounteredError");
            activity.encounteredError();
            break;
        case EventHandler.HardwareAccelerationError:
            Log.i(TAG, "HardwareAccelerationError");
            activity.handleHardwareAccelerationError();
            break;
        default:
            Log.e(TAG, String.format("Event not handled (0x%x)", msg.getData().getInt("event")));
            break;
    }
    activity.updateOverlayPausePlay();
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:60,代码来源:VideoPlayerActivity.java


示例18: eventHardwareAccelerationError

import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
public void eventHardwareAccelerationError() {
    EventHandler em = EventHandler.getInstance();
    em.callback(EventHandler.HardwareAccelerationError, new Bundle());
}
 
开发者ID:Tribler,项目名称:tribler-android,代码行数:5,代码来源:VideoPlayerActivity.java


示例19: handleMessage

import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
    VideoPlayerActivity activity = getOwner();
    if(activity == null) return;
    // Do not handle events if we are leaving the VideoPlayerActivity
    if (activity.mSwitchingView) return;

    switch (msg.getData().getInt("event")) {
        case EventHandler.MediaParsedChanged:
            Log.i(TAG, "MediaParsedChanged");
            activity.updateNavStatus();
            if (!activity.mHasMenu && activity.mLibVLC.getVideoTracksCount() < 1) {
                Log.i(TAG, "No video track, open in audio mode");
                activity.switchToAudioMode();
            }
            break;
        case EventHandler.MediaPlayerPlaying:
            Log.i(TAG, "MediaPlayerPlaying");
            activity.stopLoadingAnimation();
            activity.showOverlay();
            /** FIXME: update the track list when it changes during the
             *  playback. (#7540) */
            activity.setESTrackLists(true);
            activity.setESTracks();
            activity.changeAudioFocus(true);
            activity.updateNavStatus();
            break;
        case EventHandler.MediaPlayerPaused:
            Log.i(TAG, "MediaPlayerPaused");
            break;
        case EventHandler.MediaPlayerStopped:
            Log.i(TAG, "MediaPlayerStopped");
            activity.changeAudioFocus(false);
            break;
        case EventHandler.MediaPlayerEndReached:
            Log.i(TAG, "MediaPlayerEndReached");
            activity.changeAudioFocus(false);
            activity.endReached();
            break;
        case EventHandler.MediaPlayerVout:
            activity.updateNavStatus();
            if (!activity.mHasMenu)
                activity.handleVout(msg);
            break;
        case EventHandler.MediaPlayerPositionChanged:
            if (!activity.mCanSeek)
                activity.mCanSeek = true;
            //don't spam the logs
            break;
        case EventHandler.MediaPlayerEncounteredError:
            Log.i(TAG, "MediaPlayerEncounteredError");
            activity.encounteredError();
            break;
        case EventHandler.HardwareAccelerationError:
            Log.i(TAG, "HardwareAccelerationError");
            activity.handleHardwareAccelerationError();
            break;
        default:
            Log.e(TAG, String.format("Event not handled (0x%x)", msg.getData().getInt("event")));
            break;
    }
    activity.updateOverlayPausePlay();
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:64,代码来源:VideoPlayerActivity.java


示例20: onCreate

import org.videolan.libvlc.EventHandler; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    // Get libVLC instance
    try {
        mLibVLC = VLCInstance.getLibVlcInstance();
    } catch (LibVlcException e) {
        e.printStackTrace();
    }

    mCallback = new HashMap<IAudioServiceCallback, Integer>();
    mCurrentIndex = -1;
    mPrevIndex = -1;
    mNextIndex = -1;
    mPrevious = new Stack<Integer>();
    mEventHandler = EventHandler.getInstance();
    mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(),
            RemoteControlClientReceiver.class.getName());

    // Make sure the audio player will acquire a wake-lock while playing. If we don't do
    // that, the CPU might go to sleep while the song is playing, causing playback to stop.
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);

    IntentFilter filter = new IntentFilter();
    filter.setPriority(Integer.MAX_VALUE);
    filter.addAction(ACTION_REMOTE_BACKWARD);
    filter.addAction(ACTION_REMOTE_PLAYPAUSE);
    filter.addAction(ACTION_REMOTE_PLAY);
    filter.addAction(ACTION_REMOTE_PAUSE);
    filter.addAction(ACTION_REMOTE_STOP);
    filter.addAction(ACTION_REMOTE_FORWARD);
    filter.addAction(ACTION_REMOTE_LAST_PLAYLIST);
    filter.addAction(ACTION_WIDGET_INIT);
    filter.addAction(Intent.ACTION_HEADSET_PLUG);
    filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    filter.addAction(VLCApplication.SLEEP_INTENT);
    registerReceiver(serviceReceiver, filter);

    final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    boolean stealRemoteControl = pref.getBoolean("enable_steal_remote_control", false);

    if (!LibVlcUtil.isFroyoOrLater() || stealRemoteControl) {
        /* Backward compatibility for API 7 */
        filter = new IntentFilter();
        if (stealRemoteControl)
            filter.setPriority(Integer.MAX_VALUE);
        filter.addAction(Intent.ACTION_MEDIA_BUTTON);
        mRemoteControlClientReceiver = new RemoteControlClientReceiver();
        registerReceiver(mRemoteControlClientReceiver, filter);
    }
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:54,代码来源:AudioService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleThrowawayClassLoader类代码示例发布时间:2022-05-22
下一篇:
Java FTPException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap