title: exoplayer2 duration is -9223372036854775807, how to solve this?
body: <p>I record my audio and send this to server. when I get the file from server, I can hear my audio. But the duration of that file is -9223372036854775807. I don't understand this weird... short recorded audio is fine. But when I record audio close to 1 min or over, I got this problem. The current position is logged well but not the total duration. how to solve this?</p>
  
  <pre><code>private fun initializePlayer() {
          if (player == null) {
              val trackSelector = DefaultTrackSelector()
              trackSelector.setParameters(
                  trackSelector.buildUponParameters().setMaxVideoSizeSd()
              )
              player = ExoPlayerFactory.newSimpleInstance(this,trackSelector)
              binding.musicPlayer.player = player
              binding.musicPlayer.useController=false
              defaultDataSourceFactory = DefaultDataSourceFactory(this, this.getString(R.string.app_name))
              mediaSourceFactory = ProgressiveMediaSource.Factory(defaultDataSourceFactory)
              player!!.playWhenReady = false
              player!!.addListener(object : Player.EventListener {
                  override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) {
                      when (playbackState) {
                          Player.STATE_IDLE -&gt; {
  
                          }
                          Player.STATE_BUFFERING -&gt; {
  
                          }
                          Player.STATE_READY -&gt; {
                              showLog("totalDuration : "+player!!.duration)
                          }
                          Player.STATE_ENDED -&gt; {
                              player!!.playWhenReady = false
                              activeHolder?.run {
                                  binding.progressBar.progress = 0
                                  showAudioStartButton(activeHolder!!)
                                  activeHolder = null
                              }
                              handlerChangeProgress.removeCallbacks(updateChangeProgressTask)
                              currentAudioPosition = 0
                              maxAudioPosition = 0
                              player!!.seekTo(0)
                          }
                      }
                  }
              })
          }
      }
  
  
  
  </code></pre>
  
  <p><em>Log</em></p>
  
  <pre><code>D/TAG: totalDuration : -9223372036854775807
  </code></pre>