-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent,android.view.accessibility.AccessibilityEventSource,com.shuyu.gsyvideoplayer.listener.GSYMediaPlayerListener,com.shuyu.gsyvideoplayer.render.view.listener.IGSYSurfaceListener,com.shuyu.gsyvideoplayer.utils.MeasureHelper.MeasureFormVideoParamsListener
public abstract class GSYVideoView extends GSYTextureRenderView implements GSYMediaPlayerListener
视频回调与状态处理等相关层 Created by guoshuyu on 2017/8/2.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intCURRENT_STATE_NORMALpublic final static intCURRENT_STATE_PREPAREINGpublic final static intCURRENT_STATE_PLAYINGpublic final static intCURRENT_STATE_PLAYING_BUFFERING_STARTpublic final static intCURRENT_STATE_PAUSEpublic final static intCURRENT_STATE_AUTO_COMPLETEpublic final static intCURRENT_STATE_ERRORpublic final static intCHANGE_DELAY_TIME
-
Constructor Summary
Constructors Constructor Description GSYVideoView(Context context)GSYVideoView(Context context, AttributeSet attrs)GSYVideoView(Context context, AttributeSet attrs, int defStyleAttr)GSYVideoView(Context context, Boolean fullFlag)
-
Method Summary
Modifier and Type Method Description intgetCurrentVideoWidth()intgetCurrentVideoHeight()intgetVideoSarNum()intgetVideoSarDen()booleansetUp(String url, boolean cacheWithPlay, String title)设置播放URL booleansetUp(String url, boolean cacheWithPlay, File cachePath, Map<String, String> mapHeadData, String title)设置播放URL booleansetUp(String url, boolean cacheWithPlay, File cachePath, String title)设置播放URL voidonVideoReset()重置 voidonVideoPause()暂停状态 voidonVideoResume()恢复暂停状态 voidonVideoResume(boolean seek)恢复暂停状态 voidonPrepared()voidonAutoCompletion()voidonCompletion()voidonSeekComplete()voidonError(int what, int extra)voidonInfo(int what, int extra)voidonVideoSizeChanged()voidclearCurrentCache()清除当前缓存 longgetCurrentPositionWhenPlaying()获取当前播放进度 longgetDuration()获取当前总时长 voidrelease()释放吧 voidstartAfterPrepared()prepared成功之后会开始播放 abstract GSYVideoViewBridgegetGSYVideoManager()获取管理器桥接的实现 abstract intgetLayoutId()当前UI abstract voidstartPlayLogic()开始播放 intgetCurrentState()获取当前播放状态 booleanisInPlayingState()根据状态判断是否播放中 StringgetPlayTag()播放tag防止错误,因为普通的url也可能重复 voidsetPlayTag(String playTag)播放tag防止错误,因为普通的url也可能重复 intgetPlayPosition()voidsetPlayPosition(int playPosition)设置播放位置防止错位 longgetNetSpeed()网络速度注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的再打开已经缓存的本地文件,网络速度才会回0. StringgetNetSpeedText()网络速度注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的再打开已经缓存的本地文件,网络速度才会回0. longgetSeekOnStart()voidsetSeekOnStart(long seekOnStart)从哪里开始播放目前有时候前几秒有跳动问题,毫秒需要在startPlayLogic之前,即播放开始之前 intgetBuffterPoint()缓冲进度/缓存进度 booleanisIfCurrentIsFullscreen()是否全屏 voidsetIfCurrentIsFullscreen(boolean ifCurrentIsFullscreen)booleanisLooping()voidsetLooping(boolean looping)设置循环 voidsetVideoAllCallBack(VideoAllCallBack mVideoAllCallBack)设置播放过程中的回调 floatgetSpeed()voidsetSpeed(float speed)播放速度 voidsetSpeed(float speed, boolean soundTouch)播放速度 voidsetSpeedPlaying(float speed, boolean soundTouch)播放中生效的播放数据 booleanisShowPauseCover()voidsetShowPauseCover(boolean showPauseCover)是否需要加载显示暂停的cover图片打开状态下,暂停退到后台,再回到前台不会显示黑屏,但可以对某些机型有概率出现OOM关闭情况下,暂停退到后台,再回到前台显示黑屏目前某些特定情况可能会出现切换视频时黑屏:https://github. voidseekTo(long position)seekto what you want booleanisStartAfterPrepared()voidsetStartAfterPrepared(boolean startAfterPrepared)准备成功之后立即播放 booleanisReleaseWhenLossAudio()voidsetReleaseWhenLossAudio(boolean releaseWhenLossAudio)长时间失去音频焦点,暂停播放器 Map<String, String>getMapHeadData()voidsetMapHeadData(Map<String, String> headData)单独设置mapHeader StringgetOverrideExtension()voidsetOverrideExtension(String overrideExtension)是否需要覆盖拓展类型,目前只针对exoPlayer内核模式有效 -
Methods inherited from class com.shuyu.gsyvideoplayer.video.base.GSYTextureRenderView
getEffectFilter, getRenderProxy, onSurfaceAvailable, onSurfaceDestroyed, onSurfaceSizeChanged, onSurfaceUpdated, setCustomGLRenderer, setEffectFilter, setGLRenderMode, setMatrixGL -
Methods inherited from class android.widget.FrameLayout
generateLayoutParams, getAccessibilityClassName, getConsiderGoneChildrenWhenMeasuring, getMeasureAllChildren, setForegroundGravity, setMeasureAllChildren, shouldDelayChildPressedState -
Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout -
Methods inherited from class android.view.View
addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearViewTranslationCallback, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContextClickable, isCredential, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHandwritingDelegate, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDataSensitive, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAllowedHandwritingDelegatePackage, setAllowedHandwritingDelegatorPackage, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHandwritingBoundsOffsets, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw -
Methods inherited from class com.shuyu.gsyvideoplayer.listener.GSYMediaPlayerListener
onBackFullscreen, onBufferingUpdate -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
GSYVideoView
GSYVideoView(Context context)
-
GSYVideoView
GSYVideoView(Context context, AttributeSet attrs)
-
GSYVideoView
GSYVideoView(Context context, AttributeSet attrs, int defStyleAttr)
-
-
Method Detail
-
getCurrentVideoWidth
int getCurrentVideoWidth()
-
getCurrentVideoHeight
int getCurrentVideoHeight()
-
getVideoSarNum
int getVideoSarNum()
-
getVideoSarDen
int getVideoSarDen()
-
setUp
boolean setUp(String url, boolean cacheWithPlay, String title)
设置播放URL
- Parameters:
url- 播放urlcacheWithPlay- 是否边播边缓存title- title
-
setUp
boolean setUp(String url, boolean cacheWithPlay, File cachePath, Map<String, String> mapHeadData, String title)
设置播放URL
- Parameters:
url- 播放urlcacheWithPlay- 是否边播边缓存cachePath- 缓存路径,如果是M3U8或者HLS,请设置为falsemapHeadData- 头部信息title- title
-
setUp
boolean setUp(String url, boolean cacheWithPlay, File cachePath, String title)
设置播放URL
- Parameters:
url- 播放urlcacheWithPlay- 是否边播边缓存cachePath- 缓存路径,如果是M3U8或者HLS,请设置为falsetitle- title
-
onVideoReset
void onVideoReset()
重置
-
onVideoPause
void onVideoPause()
暂停状态
-
onVideoResume
void onVideoResume()
恢复暂停状态
-
onVideoResume
void onVideoResume(boolean seek)
恢复暂停状态
- Parameters:
seek- 是否产生seek动作
-
onPrepared
void onPrepared()
-
onAutoCompletion
void onAutoCompletion()
-
onCompletion
void onCompletion()
-
onSeekComplete
void onSeekComplete()
-
onError
void onError(int what, int extra)
-
onInfo
void onInfo(int what, int extra)
-
onVideoSizeChanged
void onVideoSizeChanged()
-
clearCurrentCache
void clearCurrentCache()
清除当前缓存
-
getCurrentPositionWhenPlaying
long getCurrentPositionWhenPlaying()
获取当前播放进度
-
getDuration
long getDuration()
获取当前总时长
-
release
void release()
释放吧
-
startAfterPrepared
void startAfterPrepared()
prepared成功之后会开始播放
-
getGSYVideoManager
abstract GSYVideoViewBridge getGSYVideoManager()
获取管理器桥接的实现
-
getLayoutId
abstract int getLayoutId()
当前UI
-
startPlayLogic
abstract void startPlayLogic()
开始播放
-
getCurrentState
int getCurrentState()
获取当前播放状态
-
isInPlayingState
boolean isInPlayingState()
根据状态判断是否播放中
-
getPlayTag
String getPlayTag()
播放tag防止错误,因为普通的url也可能重复
-
setPlayTag
void setPlayTag(String playTag)
播放tag防止错误,因为普通的url也可能重复
- Parameters:
playTag- 保证不重复就好
-
getPlayPosition
int getPlayPosition()
-
setPlayPosition
void setPlayPosition(int playPosition)
设置播放位置防止错位
-
getNetSpeed
long getNetSpeed()
网络速度注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的再打开已经缓存的本地文件,网络速度才会回0.因为是播放本地文件了
-
getNetSpeedText
String getNetSpeedText()
网络速度注意,这里如果是开启了缓存,因为读取本地代理,缓存成功后还是存在速度的再打开已经缓存的本地文件,网络速度才会回0.因为是播放本地文件了
-
getSeekOnStart
long getSeekOnStart()
-
setSeekOnStart
void setSeekOnStart(long seekOnStart)
从哪里开始播放目前有时候前几秒有跳动问题,毫秒需要在startPlayLogic之前,即播放开始之前
-
getBuffterPoint
int getBuffterPoint()
缓冲进度/缓存进度
-
isIfCurrentIsFullscreen
boolean isIfCurrentIsFullscreen()
是否全屏
-
setIfCurrentIsFullscreen
void setIfCurrentIsFullscreen(boolean ifCurrentIsFullscreen)
-
isLooping
boolean isLooping()
-
setLooping
void setLooping(boolean looping)
设置循环
-
setVideoAllCallBack
void setVideoAllCallBack(VideoAllCallBack mVideoAllCallBack)
设置播放过程中的回调
-
getSpeed
float getSpeed()
-
setSpeed
void setSpeed(float speed)
播放速度
-
setSpeed
void setSpeed(float speed, boolean soundTouch)
播放速度
- Parameters:
speed- 速度soundTouch- 是否对6.
-
setSpeedPlaying
void setSpeedPlaying(float speed, boolean soundTouch)
播放中生效的播放数据
-
isShowPauseCover
boolean isShowPauseCover()
-
setShowPauseCover
void setShowPauseCover(boolean showPauseCover)
是否需要加载显示暂停的cover图片打开状态下,暂停退到后台,再回到前台不会显示黑屏,但可以对某些机型有概率出现OOM关闭情况下,暂停退到后台,再回到前台显示黑屏目前某些特定情况可能会出现切换视频时黑屏:https://github.com/CarGuo/GSYVideoPlayer/issues/1757#issuecomment-751981100
- Parameters:
showPauseCover- 默认true
-
seekTo
void seekTo(long position)
seekto what you want
-
isStartAfterPrepared
boolean isStartAfterPrepared()
-
setStartAfterPrepared
void setStartAfterPrepared(boolean startAfterPrepared)
准备成功之后立即播放
- Parameters:
startAfterPrepared- 默认true,false的时候需要在prepared后调用startAfterPrepared()
-
isReleaseWhenLossAudio
boolean isReleaseWhenLossAudio()
-
setReleaseWhenLossAudio
void setReleaseWhenLossAudio(boolean releaseWhenLossAudio)
长时间失去音频焦点,暂停播放器
- Parameters:
releaseWhenLossAudio- 默认true,false的时候只会暂停
-
getMapHeadData
Map<String, String> getMapHeadData()
-
setMapHeadData
void setMapHeadData(Map<String, String> headData)
单独设置mapHeader
-
getOverrideExtension
String getOverrideExtension()
-
setOverrideExtension
void setOverrideExtension(String overrideExtension)
是否需要覆盖拓展类型,目前只针对exoPlayer内核模式有效
- Parameters:
overrideExtension- 比如传入 m3u8,mp4,avi 等类型
-
-
-
-