Class JWPlayerFragment

  • All Implemented Interfaces:
    android.content.ComponentCallbacks, android.content.ComponentCallbacks2, android.view.View.OnCreateContextMenuListener

    public class JWPlayerFragment
    extends android.app.Fragment
    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.

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

     
     <fragment
     	class="com.jwplayer.pub.api.JWPlayerFragment"
     	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 android.app.Fragment

        android.app.Fragment.InstantiationException, android.app.Fragment.SavedState
    • Field Summary

      • Fields inherited from interface android.content.ComponentCallbacks2

        TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JWPlayer getPlayer()  
      void getPlayerAsync​(android.content.Context context, androidx.lifecycle.LifecycleOwner lifecycleOwner, JWPlayerImpl.PlayerInitializationListener listener)  
      JWPlayerView getPlayerView()  
      static JWPlayerFragment newInstance()
      Creates a new JWPlayerFragment with a default configuration.
      static JWPlayerFragment newInstance​(PlayerConfig playerConfig)
      Creates a new JWPlayerFragment with the given configuration.
      void onCreate​(android.os.Bundle savedInstanceState)  
      android.view.View onCreateView​(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)  
      • Methods inherited from class android.app.Fragment

        dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, onTrimMemory, onViewCreated, onViewStateRestored, postponeEnterTransition, registerForContextMenu, requestPermissions, 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

      • JWPlayerFragment

        public JWPlayerFragment()
    • Method Detail

      • newInstance

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

        public static JWPlayerFragment 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.
      • onCreate

        public void onCreate​(android.os.Bundle savedInstanceState)
        Overrides:
        onCreate in class android.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 android.app.Fragment
      • getPlayer

        public JWPlayer getPlayer()
      • getPlayerAsync

        public void getPlayerAsync​(android.content.Context context,
                                   androidx.lifecycle.LifecycleOwner lifecycleOwner,
                                   JWPlayerImpl.PlayerInitializationListener listener)