Search code examples
androidandroid-fragmentsandroid-videoviewandroid-tvandroid-7.1-nougat

Android tv app is crashing while playing video


I have built a carousel app for android tv, which shows images and plays videos. But recently it started crashing once the video starts playing. I have tested this on a mobile device it's working fine working fine. Errors I got -
E/MediaPlayer: error (1, -2147479552)
E/MediaPlayer: error (1, -38)
E/MediaPlayer: Error (1,-2147479552)
E/MediaPlayer: Error (1,-38)
E/MediaPlayer: stop called in state 0, mPlayer(0xd317c860)
E/MediaPlayer: error (-38, 0)

[![enter image description here][1]][1] [1]: https://i.sstatic.net/6mkaB.png

Test Device Info :

  • X96mini media box
  • Android Version 7.1.2

Solution

  • Once video playback completed, call stopPlayback() method. it's working fine now.

    videoView.setOnCompletionListener(mp -> { videoView.stopPlayback();} )