Java Code Examples for com.yqritc.scalablevideoview.ScalableType

The following are top voted examples for showing how to use com.yqritc.scalablevideoview.ScalableType. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: react-native-videoplayer   File: ReactVideoView.java   Source Code and License 5 votes vote down vote up
public void setResizeModeModifier(final ScalableType resizeMode) {
    mResizeMode = resizeMode;

    if (mMediaPlayerValid) {
        setScalableType(resizeMode);
        invalidate();
    }
}
 
Example 2
Project: react-native-videoplayer   File: ReactVideoViewManager.java   Source Code and License 5 votes vote down vote up
@Override
@Nullable
public Map getExportedViewConstants() {
    return MapBuilder.of(
            "ScaleNone", Integer.toString(ScalableType.LEFT_TOP.ordinal()),
            "ScaleToFill", Integer.toString(ScalableType.FIT_XY.ordinal()),
            "ScaleAspectFit", Integer.toString(ScalableType.FIT_CENTER.ordinal()),
            "ScaleAspectFill", Integer.toString(ScalableType.CENTER_CROP.ordinal())
    );
}
 
Example 3
Project: Android-ScalableVideoView   File: SampleAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Context context = holder.itemView.getContext();

    ScalableType scalableType = ScalableType.values()[position];
    holder.mTextView.setText(context.getString(R.string.sample_scale_title, position,
            scalableType.toString()));
    holder.setScalableType(scalableType);
}
 
Example 4
Project: react-native-video   File: RCTVideoView.java   Source Code and License 5 votes vote down vote up
public void setResizeModeModifier(final ScalableType resizeMode) {
    mResizeMode = resizeMode;

    if (mMediaPlayerValid) {
        setScalableType(resizeMode);
        invalidate();
    }
}
 
Example 5
Project: react-native-video   File: RCTVideoViewManager.java   Source Code and License 5 votes vote down vote up
@Override
@Nullable
public Map getExportedViewConstants() {
    return MapBuilder.of(
            "ScaleNone", Integer.toString(ScalableType.LEFT_TOP.ordinal()),
            "ScaleToFill", Integer.toString(ScalableType.FIT_XY.ordinal()),
            "ScaleAspectFit", Integer.toString(ScalableType.FIT_CENTER.ordinal()),
            "ScaleAspectFill", Integer.toString(ScalableType.CENTER_CROP.ordinal())
    );
}
 
Example 6
Project: react-native-videoplayer   File: ReactVideoView.java   Source Code and License 4 votes vote down vote up
public void startWindowFullscreen() {
//        hideSupportActionBar(getContext());
//        JCUtils.getAppCompActivity(getContext()).setRequestedOrientation(FULLSCREEN_ORIENTATION);

//        ThemedReactContext themedReactContext = (ThemedReactContext) getContext();
//        ViewGroup.LayoutParams layoutParams = this.getLayoutParams();

//        this.setLayoutParams(params);
        Log.d("xxxxxx","fullscreen");
        mMediaPlayerValid = true;
//        this.setTop(0);
//        this.setBottom(0);
//        this.setRight(0);
//        this.setLeft(0);

        lastLayout = Window.ID_ANDROID_CONTENT;
        viewGroup = (ViewGroup) mThemedReactContext.getCurrentActivity().findViewById(Window.ID_ANDROID_CONTENT);
        maskLayout = (FrameLayout) LayoutInflater.from(mThemedReactContext).inflate(R.layout.fullscreen,viewGroup);
        fullscreenPlayer = new FullscreenPlayer(mThemedReactContext, this);
        fullscreenPlayer.setControls(true);
//        viewGroup.removeView(this);
        WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
        int w = wm.getDefaultDisplay().getWidth();
        int h = wm.getDefaultDisplay().getHeight();
        Log.d("xxxxx", h+"/"+w);
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(h, w);
        lp.gravity = FrameLayout.TEXT_ALIGNMENT_GRAVITY;
//        lp.addRule(RelativeLayout.CENTER_IN_PARENT);
//        SurfaceTexture mask = new SurfaceTexture();
        fullscreenPlayer.setResizeModeModifier(ScalableType.FIT_CENTER);
        this.isPlaying = mMediaPlayer.isPlaying();
        Log.d("xxxxxx","isPlaying"+(this.isPlaying()?"playing":"not playing"));
        this.pause();
        lp.setMargins(0, 0, 0, 0);
        this.hideHeaderBar();

        maskLayout.addView(fullscreenPlayer,w,h);
//        viewGroup.addView(maskLayout);
        fullscreenPlayer.setLayoutParams(lp);

        fullscreenPlayer.setSrc(mSrcUriString,mSrcType,mSrcIsNetwork,mSrcIsAsset);
        fullscreenPlayer.mMediaPlayerValid = true;
        fullscreenPlayer.seekTo(this.getCurrentPosition());
        //播放状态同步
        if(!this.isPlaying){
            fullscreenPlayer.pause();
        }
        mThemedReactContext.getCurrentActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
 
Example 7
Project: react-native-videoplayer   File: ReactVideoViewManager.java   Source Code and License 4 votes vote down vote up
@ReactProp(name = PROP_RESIZE_MODE)
public void setResizeMode(final ReactVideoView videoView, final String resizeModeOrdinalString) {
    videoView.setResizeModeModifier(ScalableType.values()[Integer.parseInt(resizeModeOrdinalString)]);
}
 
Example 8
Project: Android-ScalableVideoView   File: SampleAdapter.java   Source Code and License 4 votes vote down vote up
@Override
public int getItemCount() {
    return ScalableType.values().length;
}
 
Example 9
Project: Android-ScalableVideoView   File: SampleAdapter.java   Source Code and License 4 votes vote down vote up
public void setScalableType(ScalableType type) {
    mScalableType = type;
}
 
Example 10
Project: react-native-video   File: RCTVideoViewManager.java   Source Code and License 4 votes vote down vote up
@ReactProp(name = PROP_RESIZE_MODE)
public void setResizeMode(final RCTVideoView videoView, final String resizeModeOrdinalString) {
    videoView.setResizeModeModifier(ScalableType.values()[Integer.parseInt(resizeModeOrdinalString)]);
}