Class JWPlayerSupportFragment

  • All Implemented Interfaces:
    android.content.ComponentCallbacks, android.view.View.OnCreateContextMenuListener, androidx.lifecycle.LifecycleOwner, androidx.lifecycle.ViewModelStoreOwner, EventListener, VideoPlayerEvents.OnFullscreenListener

    public class JWPlayerSupportFragment
    extends androidx.fragment.app.Fragment
    implements VideoPlayerEvents.OnFullscreenListener
    This fragment is the simplest way to use a JW Player in your application.

    It's a wrapper around the JWPlayerView that takes care of it's lifecycle needs and takes care of fullscreening.

    Being a fragment you can add this fragment to your layout using the following code below:

     
     <fragment
     	class="com.longtailvideo.jwplayer.JWPlayerSupportFragment"
     	android:layout_width="match_parent"
     	android:layout_height="match_parent"/>
     
     

    It is assumed that the enclosing Activity inherits (directly or indirectly) from AppCompatActivity.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class androidx.fragment.app.Fragment

        androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JWPlayerView getPlayer()  
      static JWPlayerSupportFragment newInstance()
      Creates a new JWPlayerFragment with a default configuration.
      static JWPlayerSupportFragment newInstance​(PlayerConfig playerConfig)
      Creates a new JWPlayerFragment with the given configuration.
      void onActivityCreated​(android.os.Bundle savedInstanceState)  
      void onConfigurationChanged​(android.content.res.Configuration newConfig)  
      void onCreate​(android.os.Bundle savedInstanceState)  
      android.view.View onCreateView​(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)  
      void onDestroy()  
      void onFullscreen​(FullscreenEvent fullscreenEvent)
      Fired when the player toggles fullscreen mode.
      void onInflate​(android.app.Activity activity, android.util.AttributeSet attrs, android.os.Bundle savedInstanceState)  
      void onInflate​(android.content.Context context, android.util.AttributeSet attrs, android.os.Bundle savedInstanceState)  
      void onPause()  
      void onResume()  
      void onStart()  
      void onStop()  
      void setFullscreenOnDeviceRotate​(boolean fullscreenOnDeviceRotate)  
      • Methods inherited from class androidx.fragment.app.Fragment

        dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityResult, onAttach, onAttach, onAttachFragment, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onSaveInstanceState, onViewCreated, onViewStateRestored, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireContext, requireFragmentManager, requireHost, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JWPlayerSupportFragment

        public JWPlayerSupportFragment()
    • Method Detail

      • newInstance

        public static JWPlayerSupportFragment newInstance()
        Creates a new JWPlayerFragment with a default configuration.
        Returns:
        A new JWPlayerFragment containing a default JWPlayerView.
      • newInstance

        public static JWPlayerSupportFragment newInstance​(PlayerConfig playerConfig)
        Creates a new JWPlayerFragment with the given configuration.
        Parameters:
        playerConfig - the configuration to apply to the JWPlayerView.
        Returns:
        A new JWPlayerFragment with the applied configuration.
      • onInflate

        public void onInflate​(android.app.Activity activity,
                              android.util.AttributeSet attrs,
                              android.os.Bundle savedInstanceState)
        Overrides:
        onInflate in class androidx.fragment.app.Fragment
      • onInflate

        public void onInflate​(android.content.Context context,
                              android.util.AttributeSet attrs,
                              android.os.Bundle savedInstanceState)
        Overrides:
        onInflate in class androidx.fragment.app.Fragment
      • onCreate

        public void onCreate​(android.os.Bundle savedInstanceState)
        Overrides:
        onCreate in class androidx.fragment.app.Fragment
      • onActivityCreated

        public void onActivityCreated​(android.os.Bundle savedInstanceState)
        Overrides:
        onActivityCreated in class androidx.fragment.app.Fragment
      • onCreateView

        @Nullable
        public android.view.View onCreateView​(android.view.LayoutInflater inflater,
                                              android.view.ViewGroup container,
                                              android.os.Bundle savedInstanceState)
        Overrides:
        onCreateView in class androidx.fragment.app.Fragment
      • onConfigurationChanged

        public void onConfigurationChanged​(android.content.res.Configuration newConfig)
        Specified by:
        onConfigurationChanged in interface android.content.ComponentCallbacks
        Overrides:
        onConfigurationChanged in class androidx.fragment.app.Fragment
      • setFullscreenOnDeviceRotate

        public void setFullscreenOnDeviceRotate​(boolean fullscreenOnDeviceRotate)
        Parameters:
        fullscreenOnDeviceRotate - Whether device rotations should trigger fullscreen.
      • onStart

        public void onStart()
        Overrides:
        onStart in class androidx.fragment.app.Fragment
      • onResume

        public void onResume()
        Overrides:
        onResume in class androidx.fragment.app.Fragment
      • onPause

        public void onPause()
        Overrides:
        onPause in class androidx.fragment.app.Fragment
      • onStop

        public void onStop()
        Overrides:
        onStop in class androidx.fragment.app.Fragment
      • onDestroy

        public void onDestroy()
        Overrides:
        onDestroy in class androidx.fragment.app.Fragment