Java 类com.google.android.exoplayer.VideoSurfaceView 实例源码

项目:android-tv-leanback    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    mVideo = (Video)getIntent().getSerializableExtra(Video.INTENT_EXTRA_VIDEO);

    View root = findViewById(R.id.root);
    mediaController = new MediaController(this);

    //overscan safe on 1980 * 1080 TV
    mediaController.setPadding(48, 27, 48, 27);
    mediaController.setAnchorView(root);
    shutterView = findViewById(R.id.shutter);
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    preparePlayer();
}
项目:android-tv-leanback    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    mVideo = (Video) getIntent().getSerializableExtra(Video.INTENT_EXTRA_VIDEO);

    View root = findViewById(R.id.root);
    mediaController = new MediaController(this);

    //overscan safe on 1980 * 1080 TV
    mediaController.setPadding(48, 27, 48, 27);
    mediaController.setAnchorView(root);
    shutterView = findViewById(R.id.shutter);
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    preparePlayer();
}
项目:android-tv-leanback    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    mVideo = (Video) getIntent().getSerializableExtra(Video.INTENT_EXTRA_VIDEO);

    View root = findViewById(R.id.root);
    mediaController = new MediaController(this);

    //overscan safe on 1980 * 1080 TV
    mediaController.setPadding(48, 27, 48, 27);
    mediaController.setAnchorView(root);
    shutterView = findViewById(R.id.shutter);
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    preparePlayer();
}
项目:android-tv-leanback    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    mVideo = (Video) getIntent().getSerializableExtra(Video.INTENT_EXTRA_VIDEO);

    View root = findViewById(R.id.root);
    mediaController = new MediaController(this);

    //overscan safe on 1980 * 1080 TV
    mediaController.setPadding(48, 27, 48, 27);
    mediaController.setAnchorView(root);
    shutterView = findViewById(R.id.shutter);
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    preparePlayer();
}
项目:android-tv-leanback    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate()");
    setContentView(R.layout.activity_player);

    mVideo = (Video) getIntent().getSerializableExtra(Video.INTENT_EXTRA_VIDEO);

    // We will use the PlaybackOverlayFragment when running on TV.
    mIsOnTv = MyUtil.isRunningInTvMode(this);
    if (mIsOnTv) {
        // On TV we will use the resource in layout-televsion
        mPlaybackOverlayFragment = (PlaybackOverlayFragment)
                getFragmentManager().findFragmentById(R.id.playback_controls_fragment);
    } else {
        shutterView = findViewById(R.id.shutter);
        View root = findViewById(R.id.root);
        mediaController = new MediaController(this);

        //overscan safe on 1980 * 1080 TV
        mediaController.setPadding(48, 27, 48, 27);
        mediaController.setAnchorView(root);
    }
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    preparePlayer();
}
项目:android-tv-leanback    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    View root = findViewById(R.id.root);
    mediaController = new MediaController(this);

    //overscan safe on 1980 * 1080 TV
    mediaController.setPadding(48, 27, 48, 27);
    mediaController.setAnchorView(root);
    shutterView = findViewById(R.id.shutter);
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    SampleSource sampleSource =
            new FrameworkSampleSource(this, Uri.parse(url), /* headers */ null, RENDERER_COUNT);

    // Build the track renderers
    videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
    TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

    // Setup the player
    player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
    player.addListener(this);
    // Build the player controls
    mediaController.setMediaPlayer(new PlayerControl(player));
    mediaController.setEnabled(true);
    player.prepare(videoRenderer, audioRenderer);
}
项目:android-tv-leanback    文件:PlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    View root = findViewById(R.id.root);
    mediaController = new MediaController(this);

    //overscan safe on 1980 * 1080 TV
    mediaController.setPadding(48, 27, 48, 27);
    mediaController.setAnchorView(root);
    shutterView = findViewById(R.id.shutter);
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    SampleSource sampleSource =
            new FrameworkSampleSource(this, Uri.parse(url), /* headers */ null, RENDERER_COUNT);

    // Build the track renderers
    videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
    TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

    // Setup the player
    player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
    player.addListener(this);
    // Build the player controls
    mediaController.setMediaPlayer(new PlayerControl(player));
    mediaController.setEnabled(true);
    player.prepare(videoRenderer, audioRenderer);
}
项目:android-exoplayer    文件:SimplePlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Intent intent = getIntent();
  contentUri = intent.getData();
  contentType = intent.getIntExtra(DemoUtil.CONTENT_TYPE_EXTRA, DemoUtil.TYPE_OTHER);
  contentId = intent.getStringExtra(DemoUtil.CONTENT_ID_EXTRA);

  mainHandler = new Handler(getMainLooper());
  builder = getRendererBuilder();

  setContentView(R.layout.player_activity_simple);
  View root = findViewById(R.id.root);
  root.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View arg0, MotionEvent arg1) {
      if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
        toggleControlsVisibility();
      }
      return true;
    }
  });

  mediaController = new MediaController(this);
  mediaController.setAnchorView(root);
  shutterView = findViewById(R.id.shutter);
  surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
  surfaceView.getHolder().addCallback(this);

  DemoUtil.setDefaultCookieManager();
}
项目:Exoplayer_VLC    文件:PlayerActivity.java   
@Override
public void onVideoSizeChanged(int width, int height, float pixelWidthAspectRatio) {
  shutterView.setVisibility(View.GONE);
  if(surfaceView instanceof com.google.android.exoplayer.VideoSurfaceView)
 ((com.google.android.exoplayer.VideoSurfaceView) surfaceView).setVideoWidthHeightRatio(
      height == 0 ? 1 : (width * pixelWidthAspectRatio) / height);
}
项目:edx-app-android    文件:PlayerDemoActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mainHandler = new Handler(getMainLooper());
    builder = getRendererBuilder();

    setContentView(R.layout.activity_player_demo);
    ViewGroup root = (ViewGroup) findViewById(R.id.root);
    root.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View arg0, MotionEvent arg1) {
            if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
                toggleControlsVisibility();
            }
            arg0.performClick();
            return true;
        }

    });

    mediaController = new EPlayerController(this);
    mediaController.setAnchorView(root);
    shutterView = findViewById(R.id.shutter);
    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);
}
项目:ExoPlayerCompat    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    surface_view = (VideoSurfaceView)findViewById(R.id.surface_view);
    surface_view.getHolder().addCallback(this);
}
项目:android-exoplayer    文件:FullPlayerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Intent intent = getIntent();
  contentUri = intent.getData();
  contentType = intent.getIntExtra(DemoUtil.CONTENT_TYPE_EXTRA, DemoUtil.TYPE_OTHER);
  contentId = intent.getStringExtra(DemoUtil.CONTENT_ID_EXTRA);

  setContentView(R.layout.player_activity_full);
  View root = findViewById(R.id.root);
  root.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View arg0, MotionEvent arg1) {
      if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
        toggleControlsVisibility();
      }
      return true;
    }
  });

  shutterView = findViewById(R.id.shutter);
  debugRootView = findViewById(R.id.controls_root);

  surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
  surfaceView.getHolder().addCallback(this);
  debugTextView = (TextView) findViewById(R.id.debug_text_view);

  playerStateTextView = (TextView) findViewById(R.id.player_state_view);
  subtitleView = (SubtitleView) findViewById(R.id.subtitles);

  mediaController = new MediaController(this);
  mediaController.setAnchorView(root);
  retryButton = (Button) findViewById(R.id.retry_button);
  retryButton.setOnClickListener(this);
  videoButton = (Button) findViewById(R.id.video_controls);
  audioButton = (Button) findViewById(R.id.audio_controls);
  textButton = (Button) findViewById(R.id.text_controls);

  DemoUtil.setDefaultCookieManager();
}