android.view.TextureView Java Examples

The following examples show how to use android.view.TextureView. 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: EmbedBottomSheet.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public void updateTextureViewPosition() {
    View view = videoView.getAspectRatioView();
    view.getLocationInWindow(position);
    position[0] -= getLeftInset();

    if (!videoView.isInline() && !animationInProgress) {
        TextureView textureView = videoView.getTextureView();
        textureView.setTranslationX(position[0]);
        textureView.setTranslationY(position[1]);
        View textureImageView = videoView.getTextureImageView();
        if (textureImageView != null) {
            textureImageView.setTranslationX(position[0]);
            textureImageView.setTranslationY(position[1]);
        }
    }
    View controlsView = videoView.getControlsView();
    if (controlsView.getParent() == container) {
        controlsView.setTranslationY(position[1]);
    } else {
        controlsView.setTranslationY(0);
    }
}
 
Example #2
Source File: EmbedBottomSheet.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void updateTextureViewPosition() {
    View view = videoView.getAspectRatioView();
    view.getLocationInWindow(position);
    position[0] -= getLeftInset();

    if (!videoView.isInline() && !animationInProgress) {
        TextureView textureView = videoView.getTextureView();
        textureView.setTranslationX(position[0]);
        textureView.setTranslationY(position[1]);
        View textureImageView = videoView.getTextureImageView();
        if (textureImageView != null) {
            textureImageView.setTranslationX(position[0]);
            textureImageView.setTranslationY(position[1]);
        }
    }
    View controlsView = videoView.getControlsView();
    if (controlsView.getParent() == container) {
        controlsView.setTranslationY(position[1]);
    } else {
        controlsView.setTranslationY(0);
    }
}
 
Example #3
Source File: EmbedBottomSheet.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void updateTextureViewPosition() {
    View view = videoView.getAspectRatioView();
    view.getLocationInWindow(position);
    position[0] -= getLeftInset();

    if (!videoView.isInline() && !animationInProgress) {
        TextureView textureView = videoView.getTextureView();
        textureView.setTranslationX(position[0]);
        textureView.setTranslationY(position[1]);
        View textureImageView = videoView.getTextureImageView();
        if (textureImageView != null) {
            textureImageView.setTranslationX(position[0]);
            textureImageView.setTranslationY(position[1]);
        }
    }
    View controlsView = videoView.getControlsView();
    if (controlsView.getParent() == container) {
        controlsView.setTranslationY(position[1]);
    } else {
        controlsView.setTranslationY(0);
    }
}
 
Example #4
Source File: CustomizePlayerView.java    From bcm-android with GNU General Public License v3.0 6 votes vote down vote up
private static void applyTextureViewRotation(TextureView textureView, int textureViewRotation) {
    float textureViewWidth = textureView.getWidth();
    float textureViewHeight = textureView.getHeight();
    if (textureViewWidth == 0 || textureViewHeight == 0 || textureViewRotation == 0) {
        textureView.setTransform(null);
    } else {
        Matrix transformMatrix = new Matrix();
        float pivotX = textureViewWidth / 2;
        float pivotY = textureViewHeight / 2;
        transformMatrix.postRotate(textureViewRotation, pivotX, pivotY);

        // After rotation, scale the rotated texture to fit the TextureView size.
        RectF originalTextureRect = new RectF(0, 0, textureViewWidth, textureViewHeight);
        RectF rotatedTextureRect = new RectF();
        transformMatrix.mapRect(rotatedTextureRect, originalTextureRect);
        transformMatrix.postScale(
                textureViewWidth / rotatedTextureRect.width(),
                textureViewHeight / rotatedTextureRect.height(),
                pivotX,
                pivotY);
        textureView.setTransform(transformMatrix);
    }
}
 
Example #5
Source File: DoubleDecodeActivity.java    From grafika with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_double_decode);

    if (!sVideoRunning) {
        sBlob[0] = new VideoBlob((TextureView) findViewById(R.id.double1_texture_view),
                ContentManager.MOVIE_SLIDERS, 0);
        sBlob[1] = new VideoBlob((TextureView) findViewById(R.id.double2_texture_view),
                ContentManager.MOVIE_EIGHT_RECTS, 1);
        sVideoRunning = true;
    } else {
        sBlob[0].recreateView((TextureView) findViewById(R.id.double1_texture_view));
        sBlob[1].recreateView((TextureView) findViewById(R.id.double2_texture_view));
    }
}
 
Example #6
Source File: X8CustomVideoView.java    From FimiX8-RE with MIT License 6 votes vote down vote up
private void initView() {
    this.mPlayerView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.x8_custom_video_view, this);
    this.mPlayerView.setOnClickListener(this);
    this.mLoadingBar = (ProgressBar) this.mPlayerView.findViewById(R.id.load_iv);
    this.mVideoView = (TextureView) this.mPlayerView.findViewById(R.id.play_video_textureview);
    this.mBtnPlayMax = (Button) this.mPlayerView.findViewById(R.id.btn_play_max);
    this.mBtnPlayMax.setOnClickListener(this);
    this.mVideoView.setOnClickListener(this);
    this.mVideoView.setKeepScreenOn(true);
    this.mVideoView.setSurfaceTextureListener(this);
    this.mBottomPlayRl = (RelativeLayout) this.mPlayerView.findViewById(R.id.bottom_play_rl);
    this.mMiniPlayBtn = (ImageButton) this.mBottomPlayRl.findViewById(R.id.play_btn);
    this.mPlaySb = (SeekBar) this.mBottomPlayRl.findViewById(R.id.play_sb);
    this.mPlaySb.setOnSeekBarChangeListener(this);
    this.mMiniPlayBtn.setOnClickListener(this);
    this.mCurrentTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.time_current_tv);
    this.mCurrentTimeTv.setText(setTimeFormatter(0));
    this.mTotalTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.total_time_tv);
    this.mTotalTimeTv.setText(this.mTotalTime);
    showBar(true);
    this.mPlayerView.setOnClickListener(this);
    LayoutParams params = new LayoutParams(this.mScreenWidth, this.mDestationHeight);
    params.addRule(13);
    this.mPlayerView.setLayoutParams(params);
    FontUtil.changeFontLanTing(getResources().getAssets(), this.mTotalTimeTv, this.mCurrentTimeTv);
}
 
Example #7
Source File: PlayMovieActivity.java    From grafika with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_play_movie);

    mTextureView = (TextureView) findViewById(R.id.movie_texture_view);
    mTextureView.setSurfaceTextureListener(this);

    // Populate file-selection spinner.
    Spinner spinner = (Spinner) findViewById(R.id.playMovieFile_spinner);
    // Need to create one of these fancy ArrayAdapter thingies, and specify the generic layout
    // for the widget itself.
    mMovieFiles = MiscUtils.getFiles(getFilesDir(), "*.mp4");
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, mMovieFiles);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner.
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);

    updateControls();
}
 
Example #8
Source File: FimiH264Video.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void init() {
    this.mVideoWidth = 0;
    this.mVideoHeight = 0;
    setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
    setFocusable(true);
    setFocusableInTouchMode(true);
    requestFocus();
    this.mCurrentState = 0;
    this.mTargetState = 0;
    TextureView renderUIView = new TextureView(getContext());
    renderUIView.setLayoutParams(new LayoutParams(-2, -2, 17));
    renderUIView.setSurfaceTextureListener(this.mSurfaceCallback);
    this.mX8Camera9GridView = new X8Camera9GridView(getContext());
    this.mX8Camera9GridView.setLayoutParams(new LayoutParams(-1, -1, 17));
    this.mX8AiTrackContainterView = new X8AiTrackContainterView(getContext());
    this.mX8AiTrackContainterView.setLayoutParams(new LayoutParams(-1, -1, 17));
    this.blackView = new View(getContext());
    this.blackView.setLayoutParams(new LayoutParams(-1, -1, 17));
    this.blackView.setBackgroundColor(getContext().getResources().getColor(R.color.black));
    addView(renderUIView);
    addView(this.mX8AiTrackContainterView);
    addView(this.blackView);
    addView(this.mX8Camera9GridView);
    showGridLine(GlobalConfig.getInstance().getGridLine());
}
 
Example #9
Source File: SimpleVideoPlayer.java    From SimpleVideoEditor with Apache License 2.0 5 votes vote down vote up
/**
 * 开始播放
 *
 * @param request 播放的请求
 */
public void start(PlayRequest request) {
    if (mCurrentState != STATE_IDLE) {
        log("start on wrong state: " + mCurrentState);
        return;
    }

    if (request.videoSource == null) {
        log("null source is not allowed!");
        return;
    }

    mTextureView = new TextureView(getContext());
    // Instantiate and add TextureView for rendering
    final LayoutParams textureLp =
            new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT);
    textureLp.gravity = Gravity.CENTER;
    // 放在z轴最下面,防止盖住控制view
    addView(mTextureView, 0, textureLp);
    mTextureView.setSurfaceTextureListener(this);
    log("Add texture view");

    mSource = request.videoSource;
    mInitialPosition = request.startPos;
    mLoop = request.loop;
    mLeftVolume = request.leftVolume;
    mRightVolume = request.rightVolume;
    prepare();
}
 
Example #10
Source File: VideoPlayer.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public void setTextureView(TextureView texture) {
    if (textureView == texture) {
        return;
    }
    textureView = texture;
    if (player == null) {
        return;
    }
    player.setVideoTextureView(textureView);
}
 
Example #11
Source File: OwrActivityTestCase.java    From openwebrtc-android-sdk with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mTextureView = new TextureView(this);
    setContentView(mTextureView);
    KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    KeyguardManager.KeyguardLock keyguardLock = km.newKeyguardLock("TAG");
    keyguardLock.disableKeyguard();
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
 
Example #12
Source File: RxCamera.java    From RxCamera with MIT License 5 votes vote down vote up
/**
 * bind a {@link TextureView} as the camera preview surface
 * @param textureView
 * @return
 */
public Observable<RxCamera> bindTexture(final TextureView textureView) {
    return Observable.create(new Observable.OnSubscribe<RxCamera>() {
        @Override
        public void call(Subscriber<? super RxCamera> subscriber) {
            boolean result = cameraInternal.bindTextureInternal(textureView);
            if (result) {
                subscriber.onNext(RxCamera.this);
                subscriber.onCompleted();
            } else {
                subscriber.onError(cameraInternal.bindSurfaceFailedException());
            }
        }
    });
}
 
Example #13
Source File: PlaybackView.java    From justaline-android with Apache License 2.0 5 votes vote down vote up
private void init() {

        inflate(getContext(), R.layout.view_playback, this);

        setBackgroundColor(Color.BLACK);

        mAnalytics = Fa.get();

        TextureView mVideoTextureView = findViewById(R.id.video);
        mVideoTextureView.setSurfaceTextureListener(this);

        findViewById(R.id.close_button).setOnClickListener(this);
        findViewById(R.id.layout_share).setOnClickListener(this);
        findViewById(R.id.layout_save).setOnClickListener(this);

        // set margin of bottom icons to be appropriate size for screen
        View saveLayout = findViewById(R.id.layout_save);
        ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) saveLayout
                .getLayoutParams();
        layoutParams.bottomMargin = getHeightOfNavigationBar();
        saveLayout.setLayoutParams(layoutParams);

        View shareLayout = findViewById(R.id.layout_share);
        layoutParams = (ConstraintLayout.LayoutParams) shareLayout.getLayoutParams();
        layoutParams.bottomMargin = getHeightOfNavigationBar();
        shareLayout.setLayoutParams(layoutParams);

        mAudioAttributes = new AudioAttributes.Builder()
                .setUsage(AudioAttributes.USAGE_MEDIA)
                .setContentType(AudioAttributes.CONTENT_TYPE_MOVIE)
                .build();

    }
 
Example #14
Source File: FragmentShowImage.java    From iGap-Android with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * get real width and height video
 */
private void getRealSize(MediaPlayer mp, TextureView mTextureView) {

    if (mp == null || mTextureView == null) {
        return;
    }

    //Get the dimensions of the video
    int videoWidth = mp.getVideoWidth();
    int videoHeight = mp.getVideoHeight();

    Display display = G.fragmentActivity.getWindowManager().getDefaultDisplay();

    int finalWith, finalHeight;

    finalWith = display.getWidth();
    finalHeight = (int) (((float) videoHeight / (float) videoWidth) * (float) display.getWidth());

    if (finalHeight > display.getHeight()) {
        finalWith = (int) (((float) finalWith / (float) finalHeight) * (float) display.getHeight());
        finalHeight = display.getHeight();
    }

    ViewGroup.LayoutParams lp = mTextureView.getLayoutParams();
    lp.width = finalWith;
    lp.height = finalHeight;
    mTextureView.setLayoutParams(lp);
}
 
Example #15
Source File: TestUtils.java    From openwebrtc-android-sdk with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void waitForNUpdates(final TextureView textureView, int count) {
    TextureView.SurfaceTextureListener previousListener = textureView.getSurfaceTextureListener();
    final TextureViewAsserter textureViewAsserter = new TextureViewAsserter(previousListener);
    textureView.setSurfaceTextureListener(textureViewAsserter);
    TestUtils.synchronous().latchCount(count).timeout(15).run(new TestUtils.SynchronousBlock() {
        @Override
        public void run(final CountDownLatch latch) {
            textureViewAsserter.waitForUpdates(latch);
        }
    });
    textureView.setSurfaceTextureListener(previousListener);
}
 
Example #16
Source File: FoldingLayoutActivity.java    From FoldingLayout with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_fold);

    mImageView = (ImageView)findViewById(R.id.image_view);
    mImageView.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING,
            ANTIALIAS_PADDING);
    mImageView.setScaleType(ImageView.ScaleType.FIT_XY);
    mImageView.setImageDrawable(getResources().getDrawable(R.drawable.image));

    mTextureView = new TextureView(this);
    mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);

    mAnchorSeekBar = (SeekBar)findViewById(R.id.anchor_seek_bar);
    mFoldLayout = (FoldingLayout)findViewById(R.id.fold_view);
    mFoldLayout.setBackgroundColor(Color.BLACK);
    mFoldLayout.setFoldListener(mOnFoldListener);

    mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();

    mAnchorSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);

    mScrollGestureDetector = new GestureDetector(this, new ScrollGestureDetector());
    mItemSelectedListener = new ItemSelectedListener();

    mDefaultPaint = new Paint();
    mSepiaPaint = new Paint();

    ColorMatrix m1 = new ColorMatrix();
    ColorMatrix m2 = new ColorMatrix();
    m1.setSaturation(0);
    m2.setScale(1f, .95f, .82f, 1.0f);
    m1.setConcat(m2, m1);
    mSepiaPaint.setColorFilter(new ColorMatrixColorFilter(m1));
}
 
Example #17
Source File: SimpleExoPlayer.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void clearVideoTextureView(TextureView textureView) {
  verifyApplicationThread();
  if (textureView != null && textureView == this.textureView) {
    setVideoTextureView(null);
  }
}
 
Example #18
Source File: CameraImplV2.java    From habpanelviewer with GNU General Public License v3.0 5 votes vote down vote up
CameraImplV2(Activity context, TextureView prevView, boolean cameraFallback) throws CameraException {
    super(context, prevView);

    mCamManager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE);
    if (mCamManager == null) {
        throw new CameraException(mActivity.getString(R.string.couldNotObtainCameraService));
    }

    try {
        findCameraFacing(CameraCharacteristics.LENS_FACING_FRONT);

        if (mCameraId == null && cameraFallback) {
            findCameraFacing(CameraCharacteristics.LENS_FACING_BACK);
        }
    } catch (CameraAccessException e) {
        throw new CameraException(e);
    }

    if (mCameraId == null) {
        if (cameraFallback) {
            throw new CameraException(mActivity.getString(R.string.cameraMissing));
        } else {
            throw new CameraException(mActivity.getString(R.string.frontCameraMissing));
        }
    }

    mPreviewThread = new HandlerThread("previewThread");
    mPreviewThread.start();
    mPreviewHandler = new Handler(mPreviewThread.getLooper());
}
 
Example #19
Source File: VideoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void setTextureView(TextureView texture) {
    if (textureView == texture) {
        return;
    }
    textureView = texture;
    if (player == null) {
        return;
    }
    player.setVideoTextureView(textureView);
}
 
Example #20
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setVideoTextureView(TextureView textureView) {
  if (this.textureView == textureView) {
    return;
  }
  removeSurfaceCallbacks();
  this.textureView = textureView;
  needSetSurface = true;
  if (textureView == null) {
    setVideoSurfaceInternal(null, true);
    maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
  } else {
    if (textureView.getSurfaceTextureListener() != null) {
      Log.w(TAG, "Replacing existing SurfaceTextureListener.");
    }
    textureView.setSurfaceTextureListener(componentListener);
    SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture()
        : null;
    if (surfaceTexture == null) {
      setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true);
      maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
    } else {
      setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true);
      maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight());
    }
  }
}
 
Example #21
Source File: VideoViewImpl.java    From openwebrtc-android-sdk with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private TextureViewTagger(String tag, TextureView textureView) {
    mTag = tag;
    mTextureView = textureView;
    if (textureView.isAvailable()) {
        Surface surface = new Surface(textureView.getSurfaceTexture());
        WindowRegistry.get().register(mTag, surface);
    }
    mTextureView.setSurfaceTextureListener(this);
}
 
Example #22
Source File: MainActivity.java    From Android-FPVDemo with MIT License 5 votes vote down vote up
private void initUI() {
    // init mVideoSurface
    mVideoSurface = (TextureView)findViewById(R.id.video_previewer_surface);

    recordingTime = (TextView) findViewById(R.id.timer);
    mCaptureBtn = (Button) findViewById(R.id.btn_capture);
    mRecordBtn = (ToggleButton) findViewById(R.id.btn_record);
    mShootPhotoModeBtn = (Button) findViewById(R.id.btn_shoot_photo_mode);
    mRecordVideoModeBtn = (Button) findViewById(R.id.btn_record_video_mode);

    if (null != mVideoSurface) {
        mVideoSurface.setSurfaceTextureListener(this);
    }

    mCaptureBtn.setOnClickListener(this);
    mRecordBtn.setOnClickListener(this);
    mShootPhotoModeBtn.setOnClickListener(this);
    mRecordVideoModeBtn.setOnClickListener(this);

    recordingTime.setVisibility(View.INVISIBLE);

    mRecordBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startRecord();
            } else {
                stopRecord();
            }
        }
    });
}
 
Example #23
Source File: VideoMediaPlayer.java    From TigerVideo with Apache License 2.0 5 votes vote down vote up
@Override
public void setTextureView(TextureView textureView) {

    if(textureView == null && mSurfaceTexture != null) {
        mSurfaceTexture.release();
    }
    super.setTextureView(textureView);
}
 
Example #24
Source File: VideoPlayer.java    From Cinema-App-Concept with MIT License 5 votes vote down vote up
private void adjustAspectRatio(TextureView m_TextureView,int videoWidth, int videoHeight) {
    int viewWidth = m_TextureView.getWidth();
    int viewHeight = m_TextureView.getHeight();
    double aspectRatio = (double) videoHeight / videoWidth;

    int newWidth, newHeight;
    if (viewHeight > (int) (viewWidth * aspectRatio)) {
        // limited by narrow width; restrict height
        newWidth = viewWidth;
        newHeight = (int) (viewWidth * aspectRatio);
    } else {
        // limited by short height; restrict width
        newWidth = (int) (viewHeight / aspectRatio);
        newHeight = viewHeight;
    }
    int xoff = (viewWidth - newWidth) / 2;
    int yoff = (viewHeight - newHeight) / 2;
    Log.v(TAG, "video=" + videoWidth + "x" + videoHeight +
            " view=" + viewWidth + "x" + viewHeight +
            " newView=" + newWidth + "x" + newHeight +
            " off=" + xoff + "," + yoff);

    Matrix txform = new Matrix();
    m_TextureView.getTransform(txform);
    txform.setScale((float) newWidth / viewWidth, (float) newHeight / viewHeight);
    //txform.postRotate(10);          // just for fun
    txform.postTranslate(xoff, yoff);
    m_TextureView.setTransform(txform);
}
 
Example #25
Source File: AWindow.java    From libvlc-android-sdk with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setView(int id, TextureView view) {
    if (!AndroidUtil.isICSOrLater)
        throw new IllegalArgumentException("TextureView not implemented in this android version");
    ensureInitState();
    if (view == null)
        throw new NullPointerException("view is null");
    final SurfaceHelper surfaceHelper = mSurfaceHelpers[id];
    if (surfaceHelper != null)
        surfaceHelper.release();

    mSurfaceHelpers[id] = new SurfaceHelper(id, view);
}
 
Example #26
Source File: CameraView.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public CameraView(Context context, boolean frontface) {
    super(context, null);
    initialFrontface = isFrontface = frontface;
    textureView = new TextureView(context);
    textureView.setSurfaceTextureListener(this);
    addView(textureView);
    focusAreaSize = AndroidUtilities.dp(96);
    outerPaint.setColor(0xffffffff);
    outerPaint.setStyle(Paint.Style.STROKE);
    outerPaint.setStrokeWidth(AndroidUtilities.dp(2));
    innerPaint.setColor(0x7fffffff);
}
 
Example #27
Source File: VideoViewImpl.java    From openwebrtc-android-sdk with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public synchronized void setView(TextureView textureView) {
    if (textureView == null) {
        throw new NullPointerException("texture view may not be null");
    }
    if (!viewIsActive() && mVideoSource != null) {
        mVideoRenderer.setSource(mVideoSource);
    }
    stopViewTagger();
    mTextureViewTagger = new TextureViewTagger(mTag, textureView);
}
 
Example #28
Source File: MediaPlayerDemo_setSurface.java    From Vitamio with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle icicle) {
  super.onCreate(icicle);
  if (!LibsChecker.checkVitamioLibs(this))
    return;
  setContentView(R.layout.mediaplayer_3);
  mTextureView = (TextureView) findViewById(R.id.surface);
  mTextureView.setSurfaceTextureListener(this);

}
 
Example #29
Source File: CameraActivity.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initView() {
    mTextureView = (TextureView) findViewById(R.id.mTextureView);
    mCameraView = (CameraView) findViewById(R.id.mCameraView);
    mProgressbar = (CameraProgressBar) findViewById(R.id.mProgressbar);
    rl_camera = (RelativeLayout) findViewById(R.id.rl_camera);
    iv_close = (ImageView) findViewById(R.id.iv_close);
    iv_choice = (ImageView) findViewById(R.id.iv_choice);
    iv_facing = (ImageView) findViewById(R.id.iv_facing);
    tv_flash = (TextView) findViewById(R.id.tv_flash);
    mTv_tack = (TextView) findViewById(R.id.tv_tack);
    iv_close.setOnClickListener(this);
    iv_choice.setOnClickListener(this);
    iv_facing.setOnClickListener(this);
    tv_flash.setOnClickListener(this);
}
 
Example #30
Source File: TubiExoPlayerView.java    From TubiPlayer with MIT License 5 votes vote down vote up
/**
 * Set the {@link SimpleExoPlayer} to use. The {@link SimpleExoPlayer#setTextOutput} and
 * {@link SimpleExoPlayer#setVideoListener} method of the player will be called and previous
 * assignments are overridden.
 *
 * @param player The {@link SimpleExoPlayer} to use.
 */
public void setPlayer(SimpleExoPlayer player, @NonNull PlaybackActionCallback playbackActionCallback) {
    if (this.player == player) {
        return;
    }
    if (this.player != null) {
        this.player.removeListener(componentListener);
        this.player.clearTextOutput(componentListener);
        this.player.clearVideoListener(componentListener);
        if (surfaceView instanceof TextureView) {
            this.player.clearVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            this.player.clearVideoSurfaceView((SurfaceView) surfaceView);
        }
    }
    this.player = player;

    if (userController != null) {
        userController.setPlayer(player, playbackActionCallback, this);
    }

    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    if (player != null) {
        if (surfaceView instanceof TextureView) {
            player.setVideoTextureView((TextureView) surfaceView);
        } else if (surfaceView instanceof SurfaceView) {
            player.setVideoSurfaceView((SurfaceView) surfaceView);
        }
        player.setVideoListener(componentListener);
        player.setTextOutput(componentListener);
        player.addListener(componentListener);
    }
}