Android: Implement floating video player (like YouTube android app) with JW Player SDK












1















I am trying to implement Floating video player (like YouTube player which minimize when dragged to bottom right of the screen). For that I am using DraggablePanel library (https://github.com/pedrovgs/DraggablePanel).



I was having some problem while integrating it with our production code so I try to integrate it with JW player sample app
(the VideoPlayer that we are using in our app is JW player). JW player sample app is on GitHub: https://github.com/jwplayer/jwplayer-sdk-android-demo



I changed only the xml layout. But its not working as expected.



<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<TextView
android:id="@+id/output2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/ccl_blue" />

<com.github.pedrovgs.DraggableView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:draggable_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/draggable_view_my"
android:layout_width="match_parent"
android:layout_height="match_parent"

draggable_view:bottom_view_id="@+id/output"
draggable_view:top_view_id="@+id/linearlayout" //if i give id of JWPlayerView, then app crashes. So i wrapped it inside a LinearLayout

draggable_view:top_view_margin_right="1dp"
draggable_view:top_view_resize="true"

draggable_view:top_view_x_scale_factor="2.5"
draggable_view:top_view_y_scale_factor="1.5"

draggable_view:enable_click_to_maximize_view="false"
draggable_view:enable_click_to_minimize_view="false"> //this is not working. Player is getting minimised if i click on it


<LinearLayout
android:id="@+id/linearlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray"
android:orientation="vertical">

<com.longtailvideo.jwplayer.JWPlayerView
android:id="@+id/jwplayer"
android:layout_width="match_parent"
android:layout_height="250dp" />

<TextView //this TextView is not coming. Neither in Expanded view nor in minimized view
android:id="@+id/output"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#f01232"
android:text="Bottom Text View" />

</LinearLayout>

</com.github.pedrovgs.DraggableView>

</FrameLayout>


1) The player is getting minimized even when draggable_view:enable_click_to_minimize_view="false". So I am not able to pause the player or click any of the icons which appear
on the player skin. Sometimes I manage to click on the play/pause button in the expanded view mode but it also results in minimizing the player view as well.



2) video frames are not coming most of time when player is minimized. see below photo link. a white screen is coming at the bottom right corner.
https://imgur.com/a/kjqyVOe



3) if I dismissed the minimized player view(by dragging it to left/right), the audio is still coming even though the VideoView is gone.



4) if i click on fullscreen icon on playerview then it goes fullscreen but instead of showing video frames only a white screen is coming.



5) Its really hard to maximize the player. You have to SLOWLY drag upwards the minimized view exactly from the center, otherwise the minimized view goes left or right and gets dismissed.



Is the library incompatible with JW PlayerView? or Is there any other library for the same? If there is no library then how can I achieve this in android?










share|improve this question





























    1















    I am trying to implement Floating video player (like YouTube player which minimize when dragged to bottom right of the screen). For that I am using DraggablePanel library (https://github.com/pedrovgs/DraggablePanel).



    I was having some problem while integrating it with our production code so I try to integrate it with JW player sample app
    (the VideoPlayer that we are using in our app is JW player). JW player sample app is on GitHub: https://github.com/jwplayer/jwplayer-sdk-android-demo



    I changed only the xml layout. But its not working as expected.



    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <TextView
    android:id="@+id/output2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textColor="@color/ccl_blue" />

    <com.github.pedrovgs.DraggableView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:draggable_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/draggable_view_my"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    draggable_view:bottom_view_id="@+id/output"
    draggable_view:top_view_id="@+id/linearlayout" //if i give id of JWPlayerView, then app crashes. So i wrapped it inside a LinearLayout

    draggable_view:top_view_margin_right="1dp"
    draggable_view:top_view_resize="true"

    draggable_view:top_view_x_scale_factor="2.5"
    draggable_view:top_view_y_scale_factor="1.5"

    draggable_view:enable_click_to_maximize_view="false"
    draggable_view:enable_click_to_minimize_view="false"> //this is not working. Player is getting minimised if i click on it


    <LinearLayout
    android:id="@+id/linearlayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/gray"
    android:orientation="vertical">

    <com.longtailvideo.jwplayer.JWPlayerView
    android:id="@+id/jwplayer"
    android:layout_width="match_parent"
    android:layout_height="250dp" />

    <TextView //this TextView is not coming. Neither in Expanded view nor in minimized view
    android:id="@+id/output"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:textColor="#f01232"
    android:text="Bottom Text View" />

    </LinearLayout>

    </com.github.pedrovgs.DraggableView>

    </FrameLayout>


    1) The player is getting minimized even when draggable_view:enable_click_to_minimize_view="false". So I am not able to pause the player or click any of the icons which appear
    on the player skin. Sometimes I manage to click on the play/pause button in the expanded view mode but it also results in minimizing the player view as well.



    2) video frames are not coming most of time when player is minimized. see below photo link. a white screen is coming at the bottom right corner.
    https://imgur.com/a/kjqyVOe



    3) if I dismissed the minimized player view(by dragging it to left/right), the audio is still coming even though the VideoView is gone.



    4) if i click on fullscreen icon on playerview then it goes fullscreen but instead of showing video frames only a white screen is coming.



    5) Its really hard to maximize the player. You have to SLOWLY drag upwards the minimized view exactly from the center, otherwise the minimized view goes left or right and gets dismissed.



    Is the library incompatible with JW PlayerView? or Is there any other library for the same? If there is no library then how can I achieve this in android?










    share|improve this question



























      1












      1








      1


      1






      I am trying to implement Floating video player (like YouTube player which minimize when dragged to bottom right of the screen). For that I am using DraggablePanel library (https://github.com/pedrovgs/DraggablePanel).



      I was having some problem while integrating it with our production code so I try to integrate it with JW player sample app
      (the VideoPlayer that we are using in our app is JW player). JW player sample app is on GitHub: https://github.com/jwplayer/jwplayer-sdk-android-demo



      I changed only the xml layout. But its not working as expected.



      <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical">


      <TextView
      android:id="@+id/output2"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:textColor="@color/ccl_blue" />

      <com.github.pedrovgs.DraggableView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:draggable_view="http://schemas.android.com/apk/res-auto"
      android:id="@+id/draggable_view_my"
      android:layout_width="match_parent"
      android:layout_height="match_parent"

      draggable_view:bottom_view_id="@+id/output"
      draggable_view:top_view_id="@+id/linearlayout" //if i give id of JWPlayerView, then app crashes. So i wrapped it inside a LinearLayout

      draggable_view:top_view_margin_right="1dp"
      draggable_view:top_view_resize="true"

      draggable_view:top_view_x_scale_factor="2.5"
      draggable_view:top_view_y_scale_factor="1.5"

      draggable_view:enable_click_to_maximize_view="false"
      draggable_view:enable_click_to_minimize_view="false"> //this is not working. Player is getting minimised if i click on it


      <LinearLayout
      android:id="@+id/linearlayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/gray"
      android:orientation="vertical">

      <com.longtailvideo.jwplayer.JWPlayerView
      android:id="@+id/jwplayer"
      android:layout_width="match_parent"
      android:layout_height="250dp" />

      <TextView //this TextView is not coming. Neither in Expanded view nor in minimized view
      android:id="@+id/output"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:textColor="#f01232"
      android:text="Bottom Text View" />

      </LinearLayout>

      </com.github.pedrovgs.DraggableView>

      </FrameLayout>


      1) The player is getting minimized even when draggable_view:enable_click_to_minimize_view="false". So I am not able to pause the player or click any of the icons which appear
      on the player skin. Sometimes I manage to click on the play/pause button in the expanded view mode but it also results in minimizing the player view as well.



      2) video frames are not coming most of time when player is minimized. see below photo link. a white screen is coming at the bottom right corner.
      https://imgur.com/a/kjqyVOe



      3) if I dismissed the minimized player view(by dragging it to left/right), the audio is still coming even though the VideoView is gone.



      4) if i click on fullscreen icon on playerview then it goes fullscreen but instead of showing video frames only a white screen is coming.



      5) Its really hard to maximize the player. You have to SLOWLY drag upwards the minimized view exactly from the center, otherwise the minimized view goes left or right and gets dismissed.



      Is the library incompatible with JW PlayerView? or Is there any other library for the same? If there is no library then how can I achieve this in android?










      share|improve this question
















      I am trying to implement Floating video player (like YouTube player which minimize when dragged to bottom right of the screen). For that I am using DraggablePanel library (https://github.com/pedrovgs/DraggablePanel).



      I was having some problem while integrating it with our production code so I try to integrate it with JW player sample app
      (the VideoPlayer that we are using in our app is JW player). JW player sample app is on GitHub: https://github.com/jwplayer/jwplayer-sdk-android-demo



      I changed only the xml layout. But its not working as expected.



      <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical">


      <TextView
      android:id="@+id/output2"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:textColor="@color/ccl_blue" />

      <com.github.pedrovgs.DraggableView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:draggable_view="http://schemas.android.com/apk/res-auto"
      android:id="@+id/draggable_view_my"
      android:layout_width="match_parent"
      android:layout_height="match_parent"

      draggable_view:bottom_view_id="@+id/output"
      draggable_view:top_view_id="@+id/linearlayout" //if i give id of JWPlayerView, then app crashes. So i wrapped it inside a LinearLayout

      draggable_view:top_view_margin_right="1dp"
      draggable_view:top_view_resize="true"

      draggable_view:top_view_x_scale_factor="2.5"
      draggable_view:top_view_y_scale_factor="1.5"

      draggable_view:enable_click_to_maximize_view="false"
      draggable_view:enable_click_to_minimize_view="false"> //this is not working. Player is getting minimised if i click on it


      <LinearLayout
      android:id="@+id/linearlayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/gray"
      android:orientation="vertical">

      <com.longtailvideo.jwplayer.JWPlayerView
      android:id="@+id/jwplayer"
      android:layout_width="match_parent"
      android:layout_height="250dp" />

      <TextView //this TextView is not coming. Neither in Expanded view nor in minimized view
      android:id="@+id/output"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:textColor="#f01232"
      android:text="Bottom Text View" />

      </LinearLayout>

      </com.github.pedrovgs.DraggableView>

      </FrameLayout>


      1) The player is getting minimized even when draggable_view:enable_click_to_minimize_view="false". So I am not able to pause the player or click any of the icons which appear
      on the player skin. Sometimes I manage to click on the play/pause button in the expanded view mode but it also results in minimizing the player view as well.



      2) video frames are not coming most of time when player is minimized. see below photo link. a white screen is coming at the bottom right corner.
      https://imgur.com/a/kjqyVOe



      3) if I dismissed the minimized player view(by dragging it to left/right), the audio is still coming even though the VideoView is gone.



      4) if i click on fullscreen icon on playerview then it goes fullscreen but instead of showing video frames only a white screen is coming.



      5) Its really hard to maximize the player. You have to SLOWLY drag upwards the minimized view exactly from the center, otherwise the minimized view goes left or right and gets dismissed.



      Is the library incompatible with JW PlayerView? or Is there any other library for the same? If there is no library then how can I achieve this in android?







      android draggable jwplayer android-video-player viewdraghelper






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 7 '18 at 6:53







      Shikhar Deep

















      asked May 11 '17 at 3:54









      Shikhar DeepShikhar Deep

      762514




      762514
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Floating video player like youtube is technically known as picture in picture mode. When you will back press the player minimize to right bottom corner. Even you can drag player to other position. It is little bit lengthy process but you can make it.
          Here is reference tutorial.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43906252%2fandroid-implement-floating-video-player-like-youtube-android-app-with-jw-play%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Floating video player like youtube is technically known as picture in picture mode. When you will back press the player minimize to right bottom corner. Even you can drag player to other position. It is little bit lengthy process but you can make it.
            Here is reference tutorial.






            share|improve this answer




























              1














              Floating video player like youtube is technically known as picture in picture mode. When you will back press the player minimize to right bottom corner. Even you can drag player to other position. It is little bit lengthy process but you can make it.
              Here is reference tutorial.






              share|improve this answer


























                1












                1








                1







                Floating video player like youtube is technically known as picture in picture mode. When you will back press the player minimize to right bottom corner. Even you can drag player to other position. It is little bit lengthy process but you can make it.
                Here is reference tutorial.






                share|improve this answer













                Floating video player like youtube is technically known as picture in picture mode. When you will back press the player minimize to right bottom corner. Even you can drag player to other position. It is little bit lengthy process but you can make it.
                Here is reference tutorial.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 3:29









                Kamal BunkarKamal Bunkar

                273311




                273311
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43906252%2fandroid-implement-floating-video-player-like-youtube-android-app-with-jw-play%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin