Giter Club home page Giter Club logo

Comments (19)

Nick-R avatar Nick-R commented on September 15, 2024 1

@MichaelApproved ok, much clear now, thank you.

@alienslab02 did you already start developing the plugin? I'll prepare everything on my end by tomorrow my time and we can synchronize formatting together, right?

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

I think there are some existing plugins that can help with these features. Please look for whatever is already available and let me know what we need to customize.

Once we have that information, we'll continue work on adding these features to the demo app.

from cordova-plugin-demo-app.

alienslab02 avatar alienslab02 commented on September 15, 2024

Ok, So far my RND on these plugins say that though some of these plugins are available but are using deprecated functions that works on android 14-19. For greater versions of android there are new functions available in android sdk. So we need to rewrite those functions for android versions greater than 19. Let me know what you suggest.

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

@alienslab02 OK, let's put together a single plugin that'll handle all of the lock screen activities. I'd like to be compatible with Android v4.1 and higher.

@Nick-R You're working on a lock screen plugin for the iOS version. Can you please collaborate with @alienslab02 to work on a single plugin, if possible?

I'm not sure how the plugin can pass the commands to the main app. What I'm thinking is the app will set certain properties (title, graphics, position, etc) and the plugin will trigger events when the user clicks play, pause, or skip. When the app receives a triggered event, I'll adjust the media accordingly.

Does that work for both of your design ideas?

from cordova-plugin-demo-app.

Nick-R avatar Nick-R commented on September 15, 2024

@alienslab02 @MichaelApproved

I've added necessary code to the iOS code of the plugin so it now has lock-screen and remote controls (as in KATG app). Where should i push it?

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

@Nick-R Push it to this repo please.

from cordova-plugin-demo-app.

Nick-R avatar Nick-R commented on September 15, 2024

@MichaelApproved done, please check it and let me know if you want to change something.

@alienslab02 Can you please let me know how to integrate it right way into the plugin? Should i push this changes to our Media Plugin fork?

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

@Nick-R I think I misrepresented how I wanted this code to work. I was hoping the lock screen controls could be its own plugin with properties and events options that the main app will define the behavior.

For example, the main app will have a property to define the background image and title. The plugin will trigger events when someone clicks play/pause/fast forward/rewind. The main app will handle that event and change the playback state.

The idea is to have as little logic in the plugin and pass the native request into the app.

from cordova-plugin-demo-app.

Nick-R avatar Nick-R commented on September 15, 2024

Ok, i understood. I need to think how to do it so everything will work.

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

@Nick-R Try to pull out as much logic as you can, so that we won't have to duplicate the same logic within the Android version. Ideally, both you and @alienslab02 work on the plugin (this would be a new plugin that you both contribute to) to have the same properties and events firing.

Once the plugin is created, the app logic will handle what happens when a user clicks the buttons. This way, we'll have a lot of the logic within the app, instead of the plugin. It'll also reduce the duplicate code and work needed if there's a change because the Android and iOS plugins won't have much of the logic in them. Most of the logic will be within the app.

For example, if we want to change the jump to 30 seconds, the app would get the "jump ahead" event and the app will decie to jump 30 seconds, instead of the previous value of 15 seconds. If we had this logic within the plugin, then both the iOS and Android version would need to get updated.

Thanks!

from cordova-plugin-demo-app.

Nick-R avatar Nick-R commented on September 15, 2024

@MichaelApproved

I think it will be better to modify MediaPlugin then to create new plugin to control lock-screen things. We'll anyway need to modify MediaPlugin to make it send current time updates and implement Jump forward/backward features. I propose to add commands for lock-screen information to Media Plugin also.

@alienslab02, what do you think?

From iOS device point of view, we'll need following commands:

  1. to set jump forward and backward buttons (with preferred interval parameter in seconds - this number will be shown on lockscreen controls automatically).
  2. to set track title (string)
  3. to set artist name (string)
  4. to jump on playback (number of seconds to jump, negative to jump back).

Let me know what do you think.

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

@Nick-R I already have all that code ready in the main app that the plugin will be used in. That's why I just need the hooks into the lock screen and I can use my existing code within the app (when the screen isn't locked) to play, pause, jump forward, update the position, etc.

I prefer to have the plugins be pass-through native features as much as possible, without logic. This way, the main app has the logic written once and can make changes to the logic more easily, without requiring updates to the plugins. The more code we pump into the plugins, the harder it'll be to update and fix bugs.

Please keep the plugin limited to raising events and accepting properties. The logic of jumping forward X seconds will be handled within the main app when the "jump forward" event has been raised from the plugin. The logic of play/pause will happen within the main app when the appropriate event is fired.

Please create the lock screen controls as it's own plugin. That'll make maintaining it much simpler and also allow us to use it for when we include videos.

Here's what the new plugin needs

Properties

  • Title
  • Sub-title
  • Graphic
  • Length of track
  • Current position within the track
  • Current state (playing or paused)

Events

  • Play button was pressed
  • Pause button was pressed
  • Jump forward button was pressed
  • Jump backwards button was pressed

from cordova-plugin-demo-app.

Nick-R avatar Nick-R commented on September 15, 2024

@MichaelApproved
I've done with this plugin. Please take a look, i've implemented test-code, you can find it in Staging/www/js/index.js file of iOS project. Please let me know if you need to change something. Also, please create a git repository for this plugin so we could collaborate on it and install it easily to other cordova apps.

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

Here's the git for the plugin https://github.com/HillsideHoldings/cordova-lock-screen-media-controls

from cordova-plugin-demo-app.

alienslab02 avatar alienslab02 commented on September 15, 2024

@MichaelApproved Do i need to add lock screen controls feature in existing cordova media plugin (in HillsideHoldings fork) or should i preparing it as a separate plugin like @Nick-R is doing?

from cordova-plugin-demo-app.

MichaelApproved avatar MichaelApproved commented on September 15, 2024

@alienslab02 Separate plugin. We'll merge your two together into this repo, once you both have the initial design setup. https://github.com/HillsideHoldings/cordova-lock-screen-media-controls

Please follow the same property names and calling conventions, so it'll be a seamless integration for the main app.

from cordova-plugin-demo-app.

Nick-R avatar Nick-R commented on September 15, 2024

Done, i've pushed plugin sources for iOS.

@alienslab02 please let me know if you need anything on this.

from cordova-plugin-demo-app.

alienslab02 avatar alienslab02 commented on September 15, 2024

Hi Nicolas!
I have pushed the plugin code in branch android. Unfortunately due to android behavior of providing this feature is a little different than iOS so i had to work with this pattern that's why i could follow your code design of this plugin. But what i have done is that considering your way to approach this feature for iOS, i have written my code in a close way of your design but in more standard way. But still you need to do some changes in your plugin code.

You can check how i used this plugin here: platforms/android/assets/www/js/index.js

Let me know if you need any help or if you are having issues we can come up with a more reliable design.

Thanks -
Bilal

from cordova-plugin-demo-app.

Nick-R avatar Nick-R commented on September 15, 2024

@alienslab02
I've updated plugin JS according to your changes, please try it: https://github.com/HillsideHoldings/cordova-lock-screen-media-controls

I've added setCurrentTime and setSkipInterval functions and Lockscreen.ACTION_PLAY & Lockscreen.ACTION_PAUSE constants, which is probably not important for android implementation.

Could you please do a merge in the plugin repo afterwards?

Thanks,
Nick

from cordova-plugin-demo-app.

Related Issues (3)

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.