Java Code Examples for com.shuyu.gsyvideoplayer.utils.Debuger#printfError()

The following examples show how to use com.shuyu.gsyvideoplayer.utils.Debuger#printfError() . 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: DetailFilterActivity.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
private void initGifHelper() {
    mGifCreateHelper = new GifCreateHelper(detailPlayer, new GSYVideoGifSaveListener() {
        @Override
        public void result(boolean success, File file) {
            detailPlayer.post(new Runnable() {
                @Override
                public void run() {
                    loadingView.setVisibility(View.GONE);
                    Toast.makeText(detailPlayer.getContext(), "创建成功", Toast.LENGTH_LONG).show();
                }
            });
        }

        @Override
        public void process(int curPosition, int total) {
            Debuger.printfError(" current " + curPosition + " total " + total);
        }
    });
}
 
Example 2
Source File: SystemPlayerManager.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
private void setSpeed(float speed) {
    if (release) {
        return;
    }
    if (mediaPlayer != null && mediaPlayer.getInternalMediaPlayer() != null && mediaPlayer.isPlayable()) {
        try {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                PlaybackParams playbackParams = new PlaybackParams();
                playbackParams.setSpeed(speed);
                mediaPlayer.getInternalMediaPlayer().setPlaybackParams(playbackParams);
            } else {
                Debuger.printfError(" not support setSpeed");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example 3
Source File: GSYVideoGLViewBaseRender.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
protected void checkGlError(final String op) {
    final int error;
    if ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
        Debuger.printfError(op + ": glError " + error);
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                if (mGSYVideoGLRenderErrorListener != null) {
                    mGSYVideoGLRenderErrorListener.onError(GSYVideoGLViewBaseRender.this, op + ": glError " + error, error, mChangeProgramSupportError);
                }
                mChangeProgramSupportError = false;
            }
        });
        //throw new RuntimeException(op + ": glError " + error);
    }
}
 
Example 4
Source File: GSYVideoGLViewBaseRender.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
protected int loadShader(int shaderType, String source) {
    int shader = GLES20.glCreateShader(shaderType);
    if (shader != 0) {
        GLES20.glShaderSource(shader, source);
        GLES20.glCompileShader(shader);
        int[] compiled = new int[1];
        GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS,
                compiled, 0);
        if (compiled[0] == 0) {
            Debuger.printfError("Could not compile shader " + shaderType + ":");
            Debuger.printfError(GLES20.glGetShaderInfoLog(shader));
            GLES20.glDeleteShader(shader);
            shader = 0;
        }
    }
    return shader;
}
 
Example 5
Source File: SmartPickVideo.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public void onSeekComplete() {
    if (mTmpManager != null) {
        GSYVideoBaseManager manager = GSYVideoManager.instance();
        GSYVideoManager.changeManager(mTmpManager);
        mTmpManager.setLastListener(manager.lastListener());
        mTmpManager.setListener(manager.listener());

        manager.setDisplay(null);

        Debuger.printfError("**** showDisplay onSeekComplete ***** " + mSurface);
        Debuger.printfError("**** showDisplay onSeekComplete isValid***** " + mSurface.isValid());
        mTmpManager.setDisplay(mSurface);
        changeUiToPlayingClear();
        resolveChangedResult();
        manager.releaseMediaPlayer();
    }
}
 
Example 6
Source File: GSYVideoView.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * 创建网络监听
 */
protected void createNetWorkState() {
    if (mNetInfoModule == null) {
        mNetInfoModule = new NetInfoModule(mContext.getApplicationContext(), new NetInfoModule.NetChangeListener() {
            @Override
            public void changed(String state) {
                if (!mNetSate.equals(state)) {
                    Debuger.printfError("******* change network state ******* " + state);
                    mNetChanged = true;
                }
                mNetSate = state;
            }
        });
        mNetSate = mNetInfoModule.getCurrentConnectionType();
    }
}
 
Example 7
Source File: DetailControlActivity.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
/*******************************竖屏全屏结束************************************/

    private void initGifHelper() {
        mGifCreateHelper = new GifCreateHelper(detailPlayer, new GSYVideoGifSaveListener() {
            @Override
            public void result(boolean success, File file) {
                detailPlayer.post(new Runnable() {
                    @Override
                    public void run() {
                        loadingView.setVisibility(View.GONE);
                        Toast.makeText(detailPlayer.getContext(), "创建成功", Toast.LENGTH_LONG).show();
                    }
                });
            }

            @Override
            public void process(int curPosition, int total) {
                Debuger.printfError(" current " + curPosition + " total " + total);
            }
        });
    }
 
Example 8
Source File: DanmakuVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 释放弹幕控件
 */
private void releaseDanmaku(DanmakuVideoPlayer danmakuVideoPlayer) {
    if (danmakuVideoPlayer != null && danmakuVideoPlayer.getDanmakuView() != null) {
        Debuger.printfError("release Danmaku!");
        danmakuVideoPlayer.getDanmakuView().release();
    }
}
 
Example 9
Source File: MultiSampleVideo.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
public String getKey() {
    if (mPlayPosition == -22) {
        Debuger.printfError(getClass().getSimpleName() + " used getKey() " + "******* PlayPosition never set. ********");
    }
    if (TextUtils.isEmpty(mPlayTag)) {
        Debuger.printfError(getClass().getSimpleName() + " used getKey() " + "******* PlayTag never set. ********");
    }
    return TAG + mPlayPosition + mPlayTag;
}
 
Example 10
Source File: GSYVideoView.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 播放错误的时候,删除缓存文件
 */
protected void deleteCacheFileWhenError() {
    clearCurrentCache();
    Debuger.printfError("Link Or mCache Error, Please Try Again " + mOriginUrl);
    if (mCache) {
        Debuger.printfError("mCache Link " + mUrl);
    }
    mUrl = mOriginUrl;
}
 
Example 11
Source File: GSYVideoGLViewBaseRender.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
protected int createProgram(String vertexSource, String fragmentSource) {
    int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
    if (vertexShader == 0) {
        return 0;
    }
    int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER,
            fragmentSource);
    if (pixelShader == 0) {
        return 0;
    }

    int program = GLES20.glCreateProgram();
    if (program != 0) {
        GLES20.glAttachShader(program, vertexShader);
        checkGlError("glAttachShader");
        GLES20.glAttachShader(program, pixelShader);
        checkGlError("glAttachShader");
        GLES20.glLinkProgram(program);
        int[] linkStatus = new int[1];
        GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS,
                linkStatus, 0);
        if (linkStatus[0] != GLES20.GL_TRUE) {
            Debuger.printfError("Could not link program: ");
            Debuger.printfError(GLES20.glGetProgramInfoLog(program));
            GLES20.glDeleteProgram(program);
            program = 0;
        }
    }
    return program;
}
 
Example 12
Source File: GSYExo2PlayerView.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void startPrepare() {
    if (getGSYVideoManager().listener() != null) {
        getGSYVideoManager().listener().onCompletion();
    }
    if (mVideoAllCallBack != null) {
        Debuger.printfLog("onStartPrepared");
        mVideoAllCallBack.onStartPrepared(mOriginUrl, mTitle, this);
    }
    getGSYVideoManager().setListener(this);
    getGSYVideoManager().setPlayTag(mPlayTag);
    getGSYVideoManager().setPlayPosition(mPlayPosition);
    mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
    try {
        ((Activity) getActivityContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } catch (Exception e) {
        e.printStackTrace();
    }
    mBackUpPlayingBufferState = -1;

    //prepare通过list初始化
    List<String> urls = new ArrayList<>();
    for (GSYVideoModel gsyVideoModel : mUriList) {
        urls.add(gsyVideoModel.getUrl());
    }

    if (urls.size() == 0) {
        Debuger.printfError("********************** urls isEmpty . Do you know why ? **********************");
    }

    ((GSYExoVideoManager) getGSYVideoManager()).prepare(urls, (mMapHeadData == null) ? new HashMap<String, String>() : mMapHeadData, mPlayPosition, mLooping, mSpeed, mExoCache, mCachePath, mOverrideExtension);

    setStateAndUi(CURRENT_STATE_PREPAREING);
}
 
Example 13
Source File: GSYVideoBaseManager.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 启动十秒的定时器进行 缓存操作
 */
protected void startTimeOutBuffer() {
    // 启动定时
    Debuger.printfError("startTimeOutBuffer");
    mainThreadHandler.postDelayed(mTimeOutRunnable, timeOut);

}
 
Example 14
Source File: GSYVideoBaseManager.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 取消 十秒的定时器进行 缓存操作
 */
protected void cancelTimeOutBuffer() {
    Debuger.printfError("cancelTimeOutBuffer");
    // 取消定时
    if (needTimeOutOther)
        mainThreadHandler.removeCallbacks(mTimeOutRunnable);
}
 
Example 15
Source File: GSYVideoBaseManager.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    if (listener != null) {
        Debuger.printfError("time out for error listener");
        listener().onError(BUFFER_TIME_OUT_ERROR, BUFFER_TIME_OUT_ERROR);
    }
}
 
Example 16
Source File: GSYBaseVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 恢复
 */
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {

    if (oldF != null && oldF.getParent() != null) {
        ViewGroup viewGroup = (ViewGroup) oldF.getParent();
        vp.removeView(viewGroup);
    }
    mCurrentState = getGSYVideoManager().getLastState();
    if (gsyVideoPlayer != null) {
        cloneParams(gsyVideoPlayer, this);
    }
    if (mCurrentState != CURRENT_STATE_NORMAL
            || mCurrentState != CURRENT_STATE_AUTO_COMPLETE) {
        createNetWorkState();
    }
    getGSYVideoManager().setListener(getGSYVideoManager().lastListener());
    getGSYVideoManager().setLastListener(null);
    setStateAndUi(mCurrentState);
    addTextureView();
    mSaveChangeViewTIme = System.currentTimeMillis();
    if (mVideoAllCallBack != null) {
        Debuger.printfError("onQuitFullscreen");
        mVideoAllCallBack.onQuitFullscreen(mOriginUrl, mTitle, this);
    }
    mIfCurrentIsFullscreen = false;
    if (mHideKey) {
        showNavKey(mContext, mSystemUiVisibility);
    }
    showSupportActionBar(mContext, mActionBar, mStatusBar);
    if (getFullscreenButton() != null) {
        getFullscreenButton().setImageResource(getEnlargeImageRes());
    }
}
 
Example 17
Source File: GSYVideoView.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 处理因切换网络而导致的问题
 */
protected void netWorkErrorLogic() {
    final long currentPosition = getCurrentPositionWhenPlaying();
    Debuger.printfError("******* Net State Changed. renew player to connect *******" + currentPosition);
    getGSYVideoManager().releaseMediaPlayer();
    postDelayed(new Runnable() {
        @Override
        public void run() {
            setSeekOnStart(currentPosition);
            startPlayLogic();
        }
    }, 500);
}
 
Example 18
Source File: GSYVideoView.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 清除当前缓存
 */
public void clearCurrentCache() {
    if (getGSYVideoManager().isCacheFile() && mCache) {
        //是否为缓存文件
        Debuger.printfError("Play Error " + mUrl);
        mUrl = mOriginUrl;
        getGSYVideoManager().clearCache(mContext, mCachePath, mOriginUrl);
    } else if (mUrl.contains("127.0.0.1")) {
        getGSYVideoManager().clearCache(getContext(), mCachePath, mOriginUrl);
    }

}
 
Example 19
Source File: GSYVideoControlView.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View v) {
    int i = v.getId();
    if (mHideKey && mIfCurrentIsFullscreen) {
        hideNavKey(mContext);
    }
    if (i == R.id.start) {
        clickStartIcon();
    } else if (i == R.id.surface_container && mCurrentState == CURRENT_STATE_ERROR) {
        if (mVideoAllCallBack != null) {
            Debuger.printfLog("onClickStartError");
            mVideoAllCallBack.onClickStartError(mOriginUrl, mTitle, this);
        }
        prepareVideo();
    } else if (i == R.id.thumb) {
        if (!mThumbPlay) {
            return;
        }
        if (TextUtils.isEmpty(mUrl)) {
            Debuger.printfError("********" + getResources().getString(R.string.no_url));
            //Toast.makeText(getActivityContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show();
            return;
        }
        if (mCurrentState == CURRENT_STATE_NORMAL) {
            if (isShowNetConfirm()) {
                showWifiDialog();
                return;
            }
            startPlayLogic();
        } else if (mCurrentState == CURRENT_STATE_AUTO_COMPLETE) {
            onClickUiToggle();
        }
    } else if (i == R.id.surface_container) {
        if (mVideoAllCallBack != null && isCurrentMediaListener()) {
            if (mIfCurrentIsFullscreen) {
                Debuger.printfLog("onClickBlankFullscreen");
                mVideoAllCallBack.onClickBlankFullscreen(mOriginUrl, mTitle, GSYVideoControlView.this);
            } else {
                Debuger.printfLog("onClickBlank");
                mVideoAllCallBack.onClickBlank(mOriginUrl, mTitle, GSYVideoControlView.this);
            }
        }
        startDismissControlViewTimer();
    }
}
 
Example 20
Source File: GSYBaseVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
/**
 * 全屏
 */
protected void resolveFullVideoShow(Context context, final GSYBaseVideoPlayer gsyVideoPlayer, final FrameLayout frameLayout) {
    LayoutParams lp = (LayoutParams) gsyVideoPlayer.getLayoutParams();
    lp.setMargins(0, 0, 0, 0);
    lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
    lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
    lp.gravity = Gravity.CENTER;
    gsyVideoPlayer.setLayoutParams(lp);
    gsyVideoPlayer.setIfCurrentIsFullscreen(true);
    mOrientationUtils = new OrientationUtils((Activity) context, gsyVideoPlayer, getOrientationOption());
    mOrientationUtils.setEnable(isRotateViewAuto());
    mOrientationUtils.setRotateWithSystem(mRotateWithSystem);
    mOrientationUtils.setOnlyRotateLand(mIsOnlyRotateLand);
    gsyVideoPlayer.mOrientationUtils = mOrientationUtils;

    final boolean isVertical = isVerticalFullByVideoSize();
    final boolean isLockLand = isLockLandByAutoFullSize();

    if (isShowFullAnimation()) {
        mInnerHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                //autoFull模式下,非横屏视频视频不横屏,并且不自动旋转
                if (!isVertical && isLockLand && mOrientationUtils != null && mOrientationUtils.getIsLand() != 1) {
                    mOrientationUtils.resolveByClick();
                }
                gsyVideoPlayer.setVisibility(VISIBLE);
                frameLayout.setVisibility(VISIBLE);
            }
        }, 300);
    } else {
        if (!isVertical && isLockLand && mOrientationUtils != null) {
            mOrientationUtils.resolveByClick();
        }
        gsyVideoPlayer.setVisibility(VISIBLE);
        frameLayout.setVisibility(VISIBLE);
    }


    if (mVideoAllCallBack != null) {
        Debuger.printfError("onEnterFullscreen");
        mVideoAllCallBack.onEnterFullscreen(mOriginUrl, mTitle, gsyVideoPlayer);
    }
    mIfCurrentIsFullscreen = true;

    checkoutState();

    checkAutoFullWithSizeAndAdaptation(gsyVideoPlayer);
}