Giter Site home page Giter Site logo

Comments (11)

charlesEnigma avatar charlesEnigma commented on June 18, 2024

Closing ticket. This issue is resolved with 1.2.0

from media.

charlesEnigma avatar charlesEnigma commented on June 18, 2024

Sorry, for the confusion. When updating to version 1.2.0 our workaround was re-enabled so it appeared to be fixed but after removing the workaround we are seeing the issue in version 1.2.0 as well.

from media.

tianyif avatar tianyif commented on June 18, 2024

Hi @charlesEnigma,

Starting from 1.2.0, MediaSession.Callback.onMediaButtonEvent has been added so you can override the default implementation and handle media buttons in a custom way. Could you please try this and see if it can solve your problem?

from media.

tianyif avatar tianyif commented on June 18, 2024

I'm re-tagging it as "bug" as we should figure out why the remote device doesn't resolve the double tap as next, because if it does, the remote device can define the behaviour of the tapping rather than the library or apps.

from media.

marcbaechinger avatar marcbaechinger commented on June 18, 2024

I think the issue is related to TV remotes that sends key events over Bluetooth. This may be a GoogleTV remote or a generic D-pad TV remote like for instance for a Sony Bravia.

The double-click detection seems to be most useful on mobile devices when a user has connected a BT headset to the device. I think it's justifiable to simply disable double-click detection on TV devices.

@charlesEnigma Any thoughts whether this would help for your case?

from media.

charlesEnigma avatar charlesEnigma commented on June 18, 2024

@tianyif,

I will try overriding MediaSession.Callback.onMediaButtonEvent and see if we can handle the media buttons in a custom way.

@marcbaechinger,
Yes, disabling double-click detection on TV devices would help our use case. By disabling double-click detection on TV devices we would simply be preventing the users from rapidly pressing buttons correct? For example, the user presses the "play/pause" button waits at least 2 seconds, and presses the "play/pause" button again triggering the "play/pause" functionality.

from media.

marcbaechinger avatar marcbaechinger commented on June 18, 2024

By disabling double-click detection on TV devices we would simply be preventing the users from rapidly pressing buttons correct?

The library doesn't swallow events after this change. All events will be delivered but the events won't be translated to a skip next event but the events arrive at the player resulting in pausing then playing again which is what the user intended to do with pressing twice.

from media.

marcbaechinger avatar marcbaechinger commented on June 18, 2024

I'm closing this issue as it is fixed with the commit above. Please open a new issue if required.

from media.

charlesEnigma avatar charlesEnigma commented on June 18, 2024

@tianyif and @marcbaechinger ,

I was able to override KEYCODE_MEDIA_PLAY_PAUSE using [MediaSession.Callback.onMediaButtonEvent].

override fun onMediaButtonEvent(
            session: MediaSession,
            controllerInfo: MediaSession.ControllerInfo,
            intent: Intent
        ): Boolean {

            val keyEvent: KeyEvent? = intent.getParcelableExtra<KeyEvent>(Intent.EXTRA_KEY_EVENT)
            val keyCode = keyEvent?.keyCode
            when (keyCode) {
                KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE  -> {
                    if(keyEvent.action == KeyEvent.ACTION_UP) {
                        if (session.player.playWhenReady) {
                            session.player.pause()
                        } else {
                            session.player.play()
                        }
                    }
                    return true
                }
                else ->  return super.onMediaButtonEvent(session, controllerInfo, intent)
            }
        }

Questions:

  1. Disable double-click detection on TV devices is this something the developer is expected to implement or will this be included in future versions of media3?

from media.

marcbaechinger avatar marcbaechinger commented on June 18, 2024

The commit referenced above implements this and this will be part of the next release.

from media.

charlesEnigma avatar charlesEnigma commented on June 18, 2024

@marcbaechinger,

Awesome and thank you. The team will be looking forward to the next release. :-)

from media.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.