Java Code Examples for android.widget.VideoView#setOnTouchListener()
The following examples show how to use
android.widget.VideoView#setOnTouchListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreviewMediaFragment.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); Log_OC.v(TAG, "onCreateView"); mView = inflater.inflate(R.layout.file_preview, container, false); mImagePreview = (ImageView) mView.findViewById(R.id.image_preview); mVideoPreview = (VideoView) mView.findViewById(R.id.video_preview); mVideoPreview.setOnTouchListener(this); mMediaController = (MediaControlView) mView.findViewById(R.id.media_controller); return mView; }
Example 2
Source File: FullScreenVideoUtil.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Creates the dialog for displaying a fullscreen VideoView. * * @return The created Dialog */ public Dialog createFullScreenVideoDialog() { if (mFullScreenVideoBundle == null) Log.i("Form.createFullScreenVideoDialog", "mFullScreenVideoBundle is null"); mFullScreenVideoView = new VideoView(mForm); mFullScreenVideoHolder = new FrameLayout(mForm); mFullScreenVideoController = new CustomMediaController(mForm); mFullScreenVideoView.setId(mFullScreenVideoView.hashCode()); mFullScreenVideoHolder.setId(mFullScreenVideoHolder.hashCode()); mFullScreenVideoView.setMediaController(mFullScreenVideoController); mFullScreenVideoView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { Log.i("FullScreenVideoUtil..onTouch", "Video Touched!!"); return false; } }); mFullScreenVideoController.setAnchorView(mFullScreenVideoView); String orientation = mForm.ScreenOrientation(); if (orientation.equals("landscape") || orientation.equals("sensorLandscape") || orientation.equals("reverseLandscape")) { mFullScreenVideoView.setLayoutParams(new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.FILL_PARENT, Gravity.CENTER)); } else { mFullScreenVideoView.setLayoutParams(new FrameLayout.LayoutParams( FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER)); } mFullScreenVideoHolder .setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); mFullScreenVideoHolder.addView(mFullScreenVideoView); // Add the MediaController to the Dialog mFullScreenVideoController.addTo(mFullScreenVideoHolder, mMediaControllerParams); mFullScreenVideoDialog.setContentView(mFullScreenVideoHolder); return mFullScreenVideoDialog; }
Example 3
Source File: FullScreenVideoViewFragment.java From CameraV with GNU General Public License v3.0 | 3 votes |
@SuppressWarnings("deprecation") @Override protected void initLayout() { super.initLayout(); mediaHolder_ = LayoutInflater.from(getActivity()).inflate(R.layout.editors_video, null); videoView = (VideoView) mediaHolder_.findViewById(R.id.video_view); // LayoutParams vv_lp = videoView.getLayoutParams(); // vv_lp.width = dims[0]; // vv_lp.height = (int) (((float) media_.dcimEntry.exif.height) / ((float) media_.dcimEntry.exif.width) * dims[0]); // videoView.setLayoutParams(vv_lp); videoView.setOnTouchListener(this); mediaHolder.addView(mediaHolder_); surfaceHolder = videoView.getHolder(); //Log.d(LOG, "surface holder dims: " + surfaceHolder.getSurfaceFrame().width() + " x " + surfaceHolder.getSurfaceFrame().height()); surfaceHolder.addCallback(this); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); //Log.d(LOG, "video view dims: " + videoView.getWidth() + " x " + videoView.getHeight()); videoControlsHolder = (LinearLayout) mediaHolder_.findViewById(R.id.video_controls_holder); videoSeekBar = (VideoSeekBar) mediaHolder_.findViewById(R.id.video_seek_bar); endpointHolder = (LinearLayout) mediaHolder_.findViewById(R.id.video_seek_bar_endpoint_holder); playPauseToggle = (ImageButton) mediaHolder_.findViewById(R.id.video_play_pause_toggle); playPauseToggle.setOnClickListener(this); playPauseToggle.setClickable(false); }