gpt4 book ai didi

com.devlin_n.yinyangplayer.player.YinYangPlayer类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 17:23:31 25 4
gpt4 key购买 nike

本文整理了Java中com.devlin_n.yinyangplayer.player.YinYangPlayer类的一些代码示例,展示了YinYangPlayer类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YinYangPlayer类的具体详情如下:
包路径:com.devlin_n.yinyangplayer.player.YinYangPlayer
类名称:YinYangPlayer

YinYangPlayer介绍

[英]播放器 Created by Devlin_n on 2017/4/7.
[中]播放器 由Devlin_n于2017年4月7日创建。

代码示例

代码示例来源:origin: yuger/TVLive

@Override
public void onBackPressed() {
  if (!yinYangPlayer.onBackPressed()) {
    super.onBackPressed();
  }
}

代码示例来源:origin: yuger/TVLive

@Override
public void onAudioFocusChange(int focusChange) {
  if (currentFocus == focusChange) {
    return;
  }
  currentFocus = focusChange;
  switch (focusChange) {
    case AudioManager.AUDIOFOCUS_GAIN:
    case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
      if (startRequested || pausedForLoss) {
        start();
        startRequested = false;
        pausedForLoss = false;
      }
      break;
    case AudioManager.AUDIOFOCUS_LOSS:
      if (isPlaying()) {
        pausedForLoss = true;
        pause();
      }
      break;
    case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
    case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
      if (isPlaying()) {
        pausedForLoss = true;
        pause();
      }
      break;
  }
}

代码示例来源:origin: yuger/TVLive

@Override
protected void onDestroy() {
  super.onDestroy();
  yinYangPlayer.release();
}

代码示例来源:origin: yuger/TVLive

private void startPlay() {
  if (isCache) videoView.enableCache();
  videoView.skipPositionWhenPlay(url, position).setVideoController(new FloatController(getApplicationContext())).start();
  wm.addView(floatView, wmParams);
}

代码示例来源:origin: yuger/TVLive

/**
 * 初始化播放器视图
 */
private void initView() {
  Constants.SCREEN_HEIGHT = WindowUtil.getScreenHeight(getContext(), false);
  Constants.SCREEN_WIDTH = WindowUtil.getScreenWidth(getContext());
  playerContainer = new FrameLayout(getContext());
  playerContainer.setBackgroundColor(Color.BLACK);
  LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
  this.addView(playerContainer, params);
}

代码示例来源:origin: yuger/TVLive

@Override
public void start() {
  if (mCurrentState == STATE_IDLE) {
    if (mAlwaysFullScreen) startFullScreenDirectly();
    if (addToPlayerManager) {
      YinYangPlayerManager.instance().releaseVideoPlayer();
      YinYangPlayerManager.instance().setCurrentVideoPlayer(this);
    }
    if (mAutoRotate && orientationEventListener != null) orientationEventListener.enable();
    if (checkNetwork()) return;
    initPlayer();
    startPrepare();
  } else if (isInPlaybackState()) {
    mMediaPlayer.start();
    mCurrentState = STATE_PLAYING;
    if (mVideoController != null) {
      mVideoController.setPlayState(mCurrentState);
    }
    if (mDanmakuView != null && mDanmakuView.isPrepared() && mDanmakuView.isPaused()) {
      mDanmakuView.resume();
    }
  }
  setKeepScreenOn(true);
  mAudioFocusHelper.requestFocus();
}

代码示例来源:origin: yuger/TVLive

@Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tv);
    yinYangPlayer = (YinYangPlayer) findViewById(R.id.player);

    String url = getIntent().getStringExtra("url");
    String name = getIntent().getStringExtra("name");

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setTitle(name);
      actionBar.setDisplayHomeAsUpEnabled(true);
    }
    StandardVideoController controller = new StandardVideoController(this);
    controller.setLive(true);
    Glide.with(this).load("http://7xqblc.com1.z0.glb.clouddn.com/tvlive.jpg").asBitmap()
        .animate(R.anim.anim_alpha_in).placeholder(android.R.color.black).into(controller.getThumb());
    yinYangPlayer.autoRotate()
//                .useAndroidMediaPlayer()
        .setUrl(url)
        .setVideoController(controller);
  }

代码示例来源:origin: yuger/TVLive

@Override
  public boolean onInfo(IMediaPlayer iMediaPlayer, int what, int extra) {
    switch (what) {
      case IMediaPlayer.MEDIA_INFO_BUFFERING_START:
        mCurrentState = STATE_BUFFERING;
        if (mVideoController != null) mVideoController.setPlayState(mCurrentState);
        break;
      case IMediaPlayer.MEDIA_INFO_BUFFERING_END:
        mCurrentState = STATE_BUFFERED;
        if (mVideoController != null) mVideoController.setPlayState(mCurrentState);
        break;
      case IjkMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: // 视频开始渲染
        if (getWindowVisibility() != VISIBLE) pause();
        break;
      case IjkMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED:
        if (mTextureView != null) mTextureView.setRotation(extra);
        break;
    }
    return true;
  }
};

代码示例来源:origin: yuger/TVLive

((IjkMediaPlayer) mMediaPlayer).setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-handle-resolution-change", 1);
  mAudioManager = (AudioManager) getContext().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
  mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
  mMediaPlayer.setOnErrorListener(onErrorListener);
  addSurfaceView();
} else {
  addTextureView();

代码示例来源:origin: yuger/TVLive

@Override
protected void onPause() {
  super.onPause();
  yinYangPlayer.pause();
}

代码示例来源:origin: yuger/TVLive

/**
 * 播放下一条视频
 */
private void playNext() {
  VideoModel videoModel = mVideoModels.get(mCurrentVideoPosition);
  if (videoModel != null) {
    mCurrentUrl = videoModel.url;
    mCurrentTitle = videoModel.title;
    mCurrentPosition = 0;
    setVideoController(videoModel.controller);
  }
}

代码示例来源:origin: yuger/TVLive

private void init() {
  setBackgroundResource(R.drawable.shape_float_window_background);
  int padding = WindowUtil.dp2px(getContext(), 1);
  setPadding(padding, padding, padding, padding);
  magicVideoView = new YinYangPlayer(getContext());
  addView(magicVideoView);
}

代码示例来源:origin: yuger/TVLive

@Override
public void stopFullScreen() {
  if (!isFullScreen) return;
  WindowUtil.showSupportActionBar(getContext(), true, true);
  WindowUtil.showNavKey(getContext());
  ViewGroup contentView = (ViewGroup) WindowUtil.scanForActivity(getContext()).findViewById(android.R.id.content);
  contentView.removeView(playerContainer);
  LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
  this.addView(playerContainer, params);
  isFullScreen = false;
  if (mVideoController != null) mVideoController.setPlayerState(PLAYER_NORMAL);
}

代码示例来源:origin: yuger/TVLive

public void releaseVideoPlayer() {
  if (mPlayer != null && mPlayer.get() != null) {
    mPlayer.get().release();
    mPlayer = null;
  }
}

代码示例来源:origin: yuger/TVLive

public boolean onBackPressed() {
    return mPlayer != null && mPlayer.get() != null && mPlayer.get().onBackPressed();
  }
}

代码示例来源:origin: yuger/TVLive

@Override
  public void onDestroy() {
    super.onDestroy();
    Constants.IS_START_FLOAT_WINDOW = false;
    if (floatView != null) wm.removeView(floatView);
    videoView.release();
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com