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


Java AspectRatioFrameLayout类代码示例

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


AspectRatioFrameLayout类属于com.google.android.exoplayer包,在下文中一共展示了AspectRatioFrameLayout类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initViews

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
private void initViews() {
  progressBar = (ProgressBar) mView.findViewById(R.id.pbar);
  surfaceView = (SurfaceView) mView.findViewById(R.id.surface_view);
  //skiptexts
  prgCenterText = (LinearLayout) mView.findViewById(R.id.seekbar_center_text);
  tvCenterCurrent = (TextView) mView.findViewById(R.id.txt_seek_currTime);
  tvCenterProg = (TextView) mView.findViewById(R.id.txt_seek_secs);
  //brightness
  /*brightnessSlider = (LinearLayout) getView(R.id.brightness_slider_container);
  ivBrightness = (ImageView) getView(R.id.brightness_image);
  ivBrightnessImage = (ImageView) getView(R.id.brightnessIcon);
  pBarBrighness = (ProgressBar) getView(R.id.brightness_slider);
  tvBrightnessPercent = (TextView) getView(R.id.brigtness_perc_center_text);
  brightnessCenterText = (LinearLayout) getView(R.id.brightness_center_text);
  //volume
  volumeSlider = (LinearLayout) getView(R.id.volume_slider_container);
  ivVolume = (ImageView) getView(R.id.vol_image);
  ivVolumeImage = (ImageView) getView(R.id.volIcon);
  pBarVolume = (VolBar) getView(R.id.volume_slider);
  tvVolumePercent = (TextView) getView(R.id.vol_perc_center_text);
  volumeCenterText = (LinearLayout) getView(R.id.vol_center_text);*/

  aspectRatioFrameLayout=(AspectRatioFrameLayout)getView(R.id.video_frame);
  rlReplay = (RelativeLayout) getView(R.id.rlReplay);
  ivReplay = (ImageView) getView(R.id.replayEvent);
  ivReplay.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
      rlReplay.setVisibility(View.GONE);
      if (exVidPlayer != null) {
        exVidPlayer.seekTo(0);
        exVidPlayer.play();
      }
    }
  });
}
 
开发者ID:karanvs,项目名称:ExVidPlayer,代码行数:36,代码来源:ExSimpleVpFragment.java

示例2: initViews

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
private void initViews() {
  progressBar = (ProgressBar) mView.findViewById(R.id.pbar);
  surfaceView = (SurfaceView) mView.findViewById(R.id.surface_view);
  //controls
  root = (LinearLayout) mView.findViewById(R.id.root);
  ivLock = (ImageButton) mView.findViewById(R.id.btn_lock);
  ivRev = (ImageButton) mView.findViewById(R.id.btn_rev);
  ivForword = (ImageButton) mView.findViewById(R.id.btn_fwd);
  ivNext = (ImageButton) mView.findViewById(R.id.btn_next);
  ivPrev = (ImageButton) mView.findViewById(R.id.btn_prev);
  ivPlayPause = (ImageButton) mView.findViewById(R.id.btn_pause);
  ivSetting = (ImageButton) mView.findViewById(R.id.btn_settings);
  mProgress = (SeekBar) mView.findViewById(R.id.seekbar);
  tvCurrent = (TextView) mView.findViewById(R.id.txt_currentTime);
  tvTotal = (TextView) mView.findViewById(R.id.txt_totalDuration);
  prgCenterText = (LinearLayout) mView.findViewById(R.id.seekbar_center_text);
  tvCenterCurrent = (TextView) mView.findViewById(R.id.txt_seek_currTime);
  tvCenterProg = (TextView) mView.findViewById(R.id.txt_seek_secs);
  //brightness
  brightnessSlider = (LinearLayout) getView(R.id.brightness_slider_container);
  ivBrightness = (ImageView) getView(R.id.brightness_image);
  ivBrightnessImage = (ImageView) getView(R.id.brightnessIcon);
  pBarBrighness = (ProgressBar) getView(R.id.brightness_slider);
  tvBrightnessPercent = (TextView) getView(R.id.brigtness_perc_center_text);
  brightnessCenterText = (LinearLayout) getView(R.id.brightness_center_text);
  //volume
  volumeSlider = (LinearLayout) getView(R.id.volume_slider_container);
  ivVolume = (ImageView) getView(R.id.vol_image);
  ivVolumeImage = (ImageView) getView(R.id.volIcon);
  pBarVolume = (VolBar) getView(R.id.volume_slider);
  tvVolumePercent = (TextView) getView(R.id.vol_perc_center_text);
  volumeCenterText = (LinearLayout) getView(R.id.vol_center_text);

  aspectRatioFrameLayout=(AspectRatioFrameLayout)getView(R.id.video_frame);
}
 
开发者ID:karanvs,项目名称:ExVidPlayer,代码行数:36,代码来源:ExVpCompleteFragment.java

示例3: initViews

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
private void initViews() {
  progressBar = (ProgressBar) mView.findViewById(R.id.pbar);
  surfaceView = (SurfaceView) mView.findViewById(R.id.surface_view);
  //skiptexts
  prgCenterText = (LinearLayout) mView.findViewById(R.id.seekbar_center_text);
  tvCenterCurrent = (TextView) mView.findViewById(R.id.txt_seek_currTime);
  tvCenterProg = (TextView) mView.findViewById(R.id.txt_seek_secs);
  //brightness
  brightnessSlider = (LinearLayout) getView(R.id.brightness_slider_container);
  ivBrightness = (ImageView) getView(R.id.brightness_image);
  ivBrightnessImage = (ImageView) getView(R.id.brightnessIcon);
  pBarBrighness = (ProgressBar) getView(R.id.brightness_slider);
  tvBrightnessPercent = (TextView) getView(R.id.brigtness_perc_center_text);
  brightnessCenterText = (LinearLayout) getView(R.id.brightness_center_text);
  //volume
  volumeSlider = (LinearLayout) getView(R.id.volume_slider_container);
  ivVolume = (ImageView) getView(R.id.vol_image);
  ivVolumeImage = (ImageView) getView(R.id.volIcon);
  pBarVolume = (VolBar) getView(R.id.volume_slider);
  tvVolumePercent = (TextView) getView(R.id.vol_perc_center_text);
  volumeCenterText = (LinearLayout) getView(R.id.vol_center_text);

  aspectRatioFrameLayout = (AspectRatioFrameLayout) getView(R.id.video_frame);

  rlReplay = (RelativeLayout) getView(R.id.rlReplay);
  ivReplay = (ImageView) getView(R.id.replayEvent);
  ivReplay.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
      rlReplay.setVisibility(View.GONE);
      if (exVidPlayer != null) {
        exVidPlayer.seekTo(0);
        exVidPlayer.play();
      }
    }
  });
}
 
开发者ID:karanvs,项目名称:ExVidPlayer,代码行数:37,代码来源:ExVpFragment.java

示例4: ExVidPlayerImp

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
public ExVidPlayerImp(Activity activity, SurfaceView surface, Handler handler,
    AspectRatioFrameLayout aspectRatioFrameLayout) {
  this.activity = activity;
  this.surface = surface;
  this.aspectRatioFrameLayout = aspectRatioFrameLayout;
  this.mainHandler = handler;
}
 
开发者ID:karanvs,项目名称:ExVidPlayer,代码行数:8,代码来源:ExVidPlayerImp.java

示例5: onCreate

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Intent intent = getIntent();
  contentUri = intent.getData();
  contentType = intent.getIntExtra(CONTENT_TYPE_EXTRA,
      Util.inferContentType(contentUri.toString()));
  useOpenGL = intent.getBooleanExtra(USE_OPENGL_ID_EXTRA, true);

  handler = new Handler();

  setContentView(R.layout.activity_video_player);
  View root = findViewById(R.id.root);
  root.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        toggleControlsVisibility();
      } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
        view.performClick();
      }
      return true;
    }
  });

  mediaController = new MediaController(this);
  mediaController.setAnchorView(root);
  videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
  surfaceView = (SurfaceView) findViewById(R.id.surface_view);
  vpxVideoSurfaceView = (VpxVideoSurfaceView) findViewById(R.id.vpx_surface_view);
  debugInfoView = (TextView) findViewById(R.id.debug_info);
  debugInfo = "";
  playerState = "";
  updateDebugInfoTextView();

  if (!maybeRequestPermission()) {
    startPlayback();
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:41,代码来源:PlayerActivity.java

示例6: onCreate

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_video_player);
    View root = findViewById(R.id.root);
    root.setOnTouchListener((view, motionEvent) -> {
        if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
            toggleControlsVisibility();
        } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
            view.performClick();
        }
        return true;
    });
    root.setOnKeyListener((v, keyCode, event) -> !(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE
            || keyCode == KeyEvent.KEYCODE_MENU) && mediaController.dispatchKeyEvent(event));

    shutterView = findViewById(R.id.shutter);

    videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles);

    mediaController = new KeyCompatibleMediaController(this);
    mediaController.setAnchorView(root);

    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager) {
        CookieHandler.setDefault(defaultCookieManager);
    }

    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
    audioCapabilitiesReceiver.register();
}
 
开发者ID:konifar,项目名称:droidkaigi2016,代码行数:37,代码来源:VideoPlayerActivity.java

示例7: initView

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
/**
 * 初始化view
 */
private void initView(Context context) {
    View.inflate(context, R.layout.ok_video_view, this);

    videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) findViewById(R.id.surface_view);

    if (surfaceView != null) {
        initExoPlayer();
    }
}
 
开发者ID:succlz123,项目名称:OkPlayer,代码行数:14,代码来源:OkVideoView.java

示例8: newInstance

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
public static ExVidPlayerImp newInstance(Activity actvity, SurfaceView surface, Handler handler,
    AspectRatioFrameLayout aspectRatioFrameLayout) {
  return new ExVidPlayerImp(actvity, surface, handler, aspectRatioFrameLayout);
}
 
开发者ID:karanvs,项目名称:ExVidPlayer,代码行数:5,代码来源:ExVidPlayer.java

示例9: onCreate

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
// TODO:
//		setContentView(R.layout.player_activity);
		setContentView(R.layout.player_activity_two);
		root = findViewById(R.id.root);
		root.setOnTouchListener(new OnTouchListener() {
			@Override
			public boolean onTouch(View view, MotionEvent motionEvent) {
				if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
					toggleControlsVisibility();
				} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
					view.performClick();
				}
				return true;
			}
		});
		root.setOnKeyListener(new OnKeyListener() {
			@Override
			public boolean onKey(View v, int keyCode, KeyEvent event) {
				if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE
						|| keyCode == KeyEvent.KEYCODE_MENU) {
					return false;
				}
				// TODO: return mediaController.dispatchKeyEvent(event);
				return goatMediaController.dispatchKeyEvent(event);
			}
		});

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

		videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
		surfaceView = (SurfaceView) 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);
		subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles);
		// TODO:
		// mediaController = new MediaController(this);
		// mediaController.setAnchorView(root);
		goatMediaController = (GoatMediaController) findViewById(R.id.media_controller);
		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);

		CookieHandler currentHandler = CookieHandler.getDefault();
		if (currentHandler != defaultCookieManager) {
			CookieHandler.setDefault(defaultCookieManager);
		}

		audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
		audioCapabilitiesReceiver.register();
		
		getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(this);
	}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:61,代码来源:PlayerActivity.java

示例10: onCreate

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.player_activity);
    View root = findViewById(R.id.root);
    root.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
                toggleControlsVisibility();
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                view.performClick();
            }
            return true;
        }
    });
    root.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE
                    || keyCode == KeyEvent.KEYCODE_MENU) {
                return false;
            }
            return mediaController.dispatchKeyEvent(event);
        }
    });

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

    videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) 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);
    subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles);

    mediaController = new KeyCompatibleMediaController(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);

    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager) {
        CookieHandler.setDefault(defaultCookieManager);
    }

    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
    audioCapabilitiesReceiver.register();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:56,代码来源:PlayerActivity.java

示例11: onCreateView

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_player, container, false);
        Context context = view.getContext();

        videoFrame = (AspectRatioFrameLayout) view.findViewById(R.id.video_frame);
//        videoFrame = (AspectRatioFrameLayout) view.findViewById(R.id.video_frame);
        shutterView = (ImageView) view.findViewById(R.id.shutter);
        progressBar = view.findViewById(R.id.progress_bar_player);

        surfaceView = (TextureView) view.findViewById(R.id.surface_view);
        surfaceView.setSurfaceTextureListener(this);

        mediaController = new VideoControllerView(context);
        mediaController.setAnchorView(videoFrame);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            ((FrameLayout)view).setTransitionGroup(true);
            videoFrame.setTransitionGroup(true);
        }

        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) videoFrame.getLayoutParams();
        layoutParams.height = (int) (LayoutTasks.getWindowWidth(context) * 9.0 / 16);
        videoFrame.setLayoutParams(layoutParams);

        getIntentThumbnail(context);
        enableBackgroundAudio = true;

        if (isInLandscape() && !isImmersiveEnabled())
            hideSystemUI();

        videoFrame.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    toggleControlsVisibility();
                } else if (event.getAction() == MotionEvent.ACTION_UP) {
                    //videoFrame.performClick();
                }
                return true;
            }
        });

        return view;
    }
 
开发者ID:PJakcson,项目名称:Mediathek,代码行数:47,代码来源:PlayerFragment.java

示例12: VideoPlayerView

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
public VideoPlayerView(Context context, PlaybackControls controller, View root) {
    mContext = context;
    mediaController = controller;
    shutterView = root.findViewById(R.id.shutter);
    videoFrame = (AspectRatioFrameLayout) root.findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) root.findViewById(R.id.surface_view);
    debugTextView = (TextView) root.findViewById(R.id.debug_text_view);
    debugView = root.findViewById(R.id.debug_view);
    statusTextView = (TextView) root.findViewById(R.id.status);
    playerStateTextView = (TextView) root.findViewById(R.id.player_state_view);
    subtitleLayout = (SubtitleLayout) root.findViewById(R.id.subtitles);
    nextEpisodeCard = root.findViewById(R.id.next_episode_card);
    episodeDetails = root.findViewById(R.id.episode_details);
    episodeTitle = (TextView) root.findViewById(R.id.episode_title);
    seriesTitle = (TextView) root.findViewById(R.id.series_title);
    duration = (TextView) root.findViewById(R.id.duration);

    ImageCardView card = (ImageCardView) root.findViewById(R.id.next_episode);
    card.setFocusable(true);
    card.setFocusableInTouchMode(true);
    card.setInfoVisibility(View.VISIBLE);
    card.setExtraVisibility(View.VISIBLE);
    card.setInfoAreaBackgroundColor(context.getResources().getColor(R.color.black_900));
    Point size = new Point(context.getResources().getDimensionPixelSize(R.dimen.card_width),
            context.getResources().getDimensionPixelSize(R.dimen.card_height));
    nextEpisode = new EpisodeCardView(context, card, size, false);
    nextEpisode.getImageCardView().setCardType(BaseCardView.CARD_TYPE_INFO_OVER);

    debugView.setVisibility(View.GONE);

    root.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            return handleTouchEvents(view, motionEvent);
        }
    });
    root.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            return handleKeyEvents(v, keyCode, event);
        }
    });
}
 
开发者ID:nextux,项目名称:sbs-android-tv,代码行数:44,代码来源:VideoPlayerView.java

示例13: bindView

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
private void bindView(FrameLayout oldRoot) {
    @SuppressLint("InflateParams")
    ViewGroup root = (ViewGroup) activity.getLayoutInflater().inflate(R.layout.player_view_layout, null);
    ViewGroupUtils.replaceView(oldRoot, root);

    root.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
                toggleControlsVisibility();
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                view.performClick();
            }
            return true;
        }
    });
    root.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
                return false;
            }
            return mediaController.dispatchKeyEvent(event);
        }
    });

    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(activity.getApplicationContext(),
            this);

    shutterView = root.findViewById(R.id.shutter);

    videoFrame = (AspectRatioFrameLayout) root.findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) root.findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);

    subtitleLayout = (SubtitleLayout) root.findViewById(R.id.subtitles);

    mediaController = new VideoControllerView(activity, false);
    mediaController.setAnchorView(root);


    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager) {
        CookieHandler.setDefault(defaultCookieManager);
    }

}
 
开发者ID:cklar,项目名称:ExoPlayerWrapper,代码行数:48,代码来源:SimpleVideoPlayer.java

示例14: onCreate

import com.google.android.exoplayer.AspectRatioFrameLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Intent intent = getIntent();
  manifestUrl = intent.getStringExtra(DASH_MANIFEST_URL_ID_EXTRA);
  isDash = manifestUrl != null;
  useOpenGL = intent.getBooleanExtra(USE_OPENGL_ID_EXTRA, true);

  handler = new Handler();

  setContentView(R.layout.activity_video_player);
  View root = findViewById(R.id.root);
  root.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        toggleControlsVisibility();
      } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
        view.performClick();
      }
      return true;
    }
  });

  mediaController = new MediaController(this);
  mediaController.setAnchorView(root);
  videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
  surfaceView = (SurfaceView) findViewById(R.id.surface_view);
  vpxVideoSurfaceView = (VpxVideoSurfaceView) findViewById(R.id.vpx_surface_view);
  debugInfoView = (TextView) findViewById(R.id.debug_info);
  playerStateView = (TextView) findViewById(R.id.player_state);

  // Set the buttons' onclick listeners.
  ((Button) findViewById(R.id.choose_file)).setOnClickListener(this);
  ((Button) findViewById(R.id.play)).setOnClickListener(this);

  // In case of DASH, start playback right away.
  if (isDash) {
    findViewById(R.id.buttons).setVisibility(View.GONE);
    ((TextView) findViewById(R.id.filename)).setVisibility(View.GONE);
    startDashPlayback();
  }
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:45,代码来源:VideoPlayer.java


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