VideoView in Android Studio

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 91

  • @SandipBhattacharya
    @SandipBhattacharya  Год назад +1

    Master programming and take your career to new heights with clear, concise C, Android, and Web Development courses for just Rs. 999 / $ 12. Get lifetime access and certificate. Click here to enroll: courses.sandipbhattacharya.com/s/store

  • @phoopwint9004
    @phoopwint9004 2 года назад +1

    What a lovely apperance! Love u

  • @alaabidi7189
    @alaabidi7189 Год назад +1

    A good Job Bro But I have a question, how can the video automatically repeat when the video is over? thankyou

  • @stellacheung3214
    @stellacheung3214 2 года назад +3

    Thank you for your useful video. I am trying to get the video in my app to play, but it's not working. Error on Logcat says: E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1

    • @SandipBhattacharya
      @SandipBhattacharya  2 года назад

      Try with a short .mp4 file.

    • @stellacheung3214
      @stellacheung3214 2 года назад

      @@SandipBhattacharya Appreciate the quick response! I've switched it out for a shorter video (just 3 mb) and this is what logcat says: E/GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false

    • @SandipBhattacharya
      @SandipBhattacharya  2 года назад

      Better to split your video into different files whose size will be less than 2MB, put inside the raw folder, and use from them.

  • @patrihanif2382
    @patrihanif2382 2 года назад +2

    Thnk sir...

  • @oscarleon5788
    @oscarleon5788 2 года назад

    Muchas gracias , mejor que otro video que ya habia visto.

  • @CodeQuik
    @CodeQuik 3 года назад +1

    This video is really helpful

  • @MuhammadEnamulIslam
    @MuhammadEnamulIslam 2 года назад +1

    Tnx

  • @SumbulRajput
    @SumbulRajput 2 года назад +1

    its saved my time thanks

  • @dawoodsdiary8209
    @dawoodsdiary8209 3 года назад +1

    Very helpful!

  • @santosmerlynb.571
    @santosmerlynb.571 2 года назад

    Thank you so much for this kind of tutorial!!

  • @mefistofel98
    @mefistofel98 3 года назад +1

    i have a question, how make video in fullscreen?

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад

      Hey, I made a video on that a few days back. Check this out:
      ruclips.net/video/B1s2GFI-1H0/видео.html
      I hope you find this useful!

  • @BathukuTheruvu
    @BathukuTheruvu 3 года назад +1

    Hai sir , how to write code for video particular time limit , like 30sec or 30mintes.

  • @raymondmapendo
    @raymondmapendo 3 года назад +2

    Can you show how to play many videos not one please

  • @roboticsmex7896
    @roboticsmex7896 4 года назад +1

    Friend, could you add a filter of intentions so that the application comes out with other applications when opening it from the option to open with this application and is more complementary?

    • @SandipBhattacharya
      @SandipBhattacharya  4 года назад

      Hi @Robotics Mex, thanks for asking a question. I'll definitely try to make a tutorial on this. :)

  • @pecintaiphone9508
    @pecintaiphone9508 2 года назад +1

    is there anyway to loop the video, thanks?

    • @SandipBhattacharya
      @SandipBhattacharya  2 года назад +1

      Try this.
      Declare this in class scope:
      VideoView videoView;
      In onCreate(), write:
      VideoView videoView = findViewById(R.id.videoView);
      videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
      @Override
      public void onPrepared(MediaPlayer mp) {
      mp.setLooping(true);
      }
      });
      videoView.setVideoPath("android.resource://"+getPackageName()+"/"+ R.raw.sandip);
      MediaController mediaController = new MediaController(this);
      mediaController.setAnchorView(videoView);
      videoView.setMediaController(mediaController);
      videoView.start();
      Hope that helps!

  • @polski_lis
    @polski_lis 3 года назад +1

    Thanks !!!

  • @shanishani1992
    @shanishani1992 2 года назад +1

    Bro.. How run a video in card view? Or how to add videos in grid lay out please make video on this thanks

  • @user-jk9cb4iv7h
    @user-jk9cb4iv7h Год назад +1

    How can I hide the controller video when pressing the back button?

    • @SandipBhattacharya
      @SandipBhattacharya  Год назад

      You mean, how can you hide the controller when pressing the back button?

    • @user-jk9cb4iv7h
      @user-jk9cb4iv7h Год назад +1

      @@SandipBhattacharya yes

    • @SandipBhattacharya
      @SandipBhattacharya  Год назад

      Follow the instructions. I've tested the code and it works for me.
      In the class scope declare a MediaController object reference.
      MediaController mediaController;
      Instantiate mediaController and write other necessary codes in onCreate().
      In the same Activity, write:
      @Override
      public void onBackPressed() {
      mediaController.setVisibility(View.GONE);
      super.onBackPressed();
      }
      Hope that helps!

    • @user-jk9cb4iv7h
      @user-jk9cb4iv7h Год назад +1

      @@SandipBhattacharya thanks

    • @SandipBhattacharya
      @SandipBhattacharya  Год назад

      @@user-jk9cb4iv7h You're most welcome!

  • @puteriayu8157
    @puteriayu8157 2 года назад +1

    sorry, but my video cannot play. why ?

  • @andresdepaz1200
    @andresdepaz1200 3 года назад +1

    thks bro!

  • @nihalramtripathi2940
    @nihalramtripathi2940 3 года назад

    How can we upload video through database

  • @pratapchudasama2944
    @pratapchudasama2944 3 года назад +1

    How to downLod video in apl
    Like youtube share link
    Any method in android studio ???

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад

      Hello,
      Using the RUclips share link you can only get the link pointing to the actual video file and not the file itself. Now, if you want to embed RUclips video in your android app, you can explore following options.
      1. Using WebView
      2. Using RUclips Android Player API

  • @kamal_054
    @kamal_054 3 года назад +2

    hello brother what about full screen
    pleas make a video how to do that

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад +1

      Coming soon.

    • @kamal_054
      @kamal_054 3 года назад +1

      @@SandipBhattacharya Thanks

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад

      Hey, I made it. If you're still looking, check this out:
      ruclips.net/video/B1s2GFI-1H0/видео.html

  • @emnahannachi7664
    @emnahannachi7664 3 года назад +1

    how can i remove the mediacontroller and display the video on loop ?

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад +2

      Hi Emna, thanks for asking a question. Follow the steps.
      Step 1: Remove or comment following 3 lines.
      MediaController mediaController = new MediaController(this);
      mediaController.setAnchorView(videoView);
      videoView.setMediaController(mediaController);
      Step 2: Start the video.
      videoView.start();
      Step 3: Attach OnPreparedListener with videoView and set the Looping.
      videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
      @Override
      public void onPrepared(MediaPlayer mp) {
      mp.setLooping(true);
      }
      });
      Hope that helps!

    • @emnahannachi7664
      @emnahannachi7664 3 года назад +1

      @@SandipBhattacharya yeeees :D it works perfectly
      thank you

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад

      Thank you so much! 😀
      Always Be Creating.

  • @suryavamsi9754
    @suryavamsi9754 4 года назад +1

    Hi i did the same code but audio is not coming can u please help me

    • @SandipBhattacharya
      @SandipBhattacharya  4 года назад

      Hi Surya, have you checked your emulator's audio level?

    • @suryavamsi9754
      @suryavamsi9754 4 года назад

      @@SandipBhattacharya yes volume is up and when i run the audio app audio is coming but no audio from video view

    • @SandipBhattacharya
      @SandipBhattacharya  4 года назад

      Share your code so that I can check.

    • @suryavamsi9754
      @suryavamsi9754 4 года назад

      @@SandipBhattacharya same as u r code

    • @SandipBhattacharya
      @SandipBhattacharya  4 года назад

      Try setting volume of media player. You can do this by first setting OnPreparedListener() on videoView object and then in onPrepared(MediaPlayer mediaPlayer) method set desired volume mediaPlayer.setVolume(0, 0);
      If this doesn't solve the problem then you might have problem with codecs. Try with another video.

  • @priyadarsak
    @priyadarsak 4 года назад +1

    How could I play all videos from my Server !!!

  • @israfilcc
    @israfilcc 3 года назад

    Thanks dude I'm using Kotlin but Java is understandable to me

  • @sherdlkalash9240
    @sherdlkalash9240 4 года назад +1

    How about full screen ???

    • @SandipBhattacharya
      @SandipBhattacharya  4 года назад +1

      Sure, I'll try to create a tutorial on that.

    • @sherdlkalash9240
      @sherdlkalash9240 4 года назад +1

      @@SandipBhattacharya ok❤

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад +1

      Hey, I made a video on that a few days back. If you still looking for it, check this out:
      ruclips.net/video/B1s2GFI-1H0/видео.html

  • @atharvamahabole2378
    @atharvamahabole2378 3 года назад

    'cant play this video' error when i run the app inspite doing every step u did :( any solution ??

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад

      Try using a small size video.

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад +1

      And, try this code:
      setContentView(R.layout.activity_main);
      VideoView videoView = findViewById(R.id.videoView);
      String uriPath = "android.resource://"+getPackageName()+"/"+R.raw.sandip;
      Uri uri = Uri.parse(uriPath);
      videoView.setVideoURI(uri);
      MediaController mediaController = new MediaController(this);
      mediaController.setAnchorView(videoView);
      videoView.setMediaController(mediaController);
      videoView.start();

  • @suryavamsi9754
    @suryavamsi9754 4 года назад +1

    Bro audio not coming from video view can u help

    • @SandipBhattacharya
      @SandipBhattacharya  4 года назад

      Pls check your emulator's audio level first. The level may be zero by default.

    • @suryavamsi9754
      @suryavamsi9754 4 года назад

      @@SandipBhattacharya i have tried installing in my device too same issue

    • @SandipBhattacharya
      @SandipBhattacharya  4 года назад

      You may email me your source code so that I can have a look.

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад

      Check out the latest app and see for any improvements: ruclips.net/video/B1s2GFI-1H0/видео.html

  • @jevanzaldivar4625
    @jevanzaldivar4625 2 года назад

    Good day sir can i add scroll view in video view layout?

    • @SandipBhattacharya
      @SandipBhattacharya  2 года назад

      Hi Jevan, I am not sure about using ScrollView in VideoView.

  • @ragulchelladurai9768
    @ragulchelladurai9768 4 года назад +1

    Bro how to do full screen

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад +1

      Coming soon

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад

      Hey, I made it. If you're still looking, check this out:
      ruclips.net/video/B1s2GFI-1H0/видео.html

  • @alexyongwaisheng5859
    @alexyongwaisheng5859 3 года назад

    how can i add video into fragment ?

    • @yeahiknow996
      @yeahiknow996 2 года назад

      Same problem, any answer ? 😭

  • @_NguyenQuangAnhTuan
    @_NguyenQuangAnhTuan 2 года назад

    ko tao raw dc

  • @pupunmohapatra8652
    @pupunmohapatra8652 3 года назад

    Hii, sir
    Mein Apko contact Karna chahatahun apka email address mil Sakta hai kya???
    Please reply me sir ?

    • @SandipBhattacharya
      @SandipBhattacharya  3 года назад +1

      Pls check the About section of this channel for contact details.

    • @pupunmohapatra8652
      @pupunmohapatra8652 3 года назад

      @@SandipBhattacharya sir email nahi hai check Kiya tha