Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
How to implement ExoPlayer with Databinding?

I have a class activity_player layout in which I have exoplayer2.ui.PlayerView and I created exo_player_control_view so that it overrides default controls in ExoPlayer. So I wanted to use Databinding in newly created custom control view but don't know how to do it. Any advice?

It is actually an open issue over here, but yet to be solved. So is there anyone who had a workaround to make exo_player_control_view Databinding friendly?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Use Like this >>>>>

private val binding by lazy {
     ActivityPipVideoPlayerBinding.inflate(layoutInflater)}

private val exoPLayerBinding by lazy {
    VdoExoControlViewBinding.inflate(LayoutInflater.from(this), binding.root, true)
}
over 4 years ago · Santiago Trujillo Report

0

You can use binding variable inside fragment/activity to access the playerView inside fragment/activity and

  val uri: Uri? = if (url is String) Uri.parse(url as String?) else url as Uri?
    val trackSelector =
        DefaultTrackSelector(AdaptiveTrackSelection.Factory(DefaultBandwidthMeter()))
    val player: SimpleExoPlayer = ExoPlayerFactory.newSimpleInstance(view.context, trackSelector)
    val dataSourceFactory = DefaultDataSourceFactory(view.context, "ua")
    val mediaSource =
        ExtractorMediaSource(uri, dataSourceFactory, DefaultExtractorsFactory(), null, null)
    player.prepare(mediaSource)
    player.apply {
        volume = 0f
        repeatMode = Player.REPEAT_MODE_ONE
        playWhenReady = true
        videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT
    }
    binding.playerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL)
    binding.playerView.player = player
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!