Key Listener/Overlay
#1
I have two questions that hinge on me attempting to create an add-on.

  1. Is it possible to create an addon that continuosly waits for a specific key to be pressed to perform an action?
  2. Can an addon create a temporary overlay on top of everything for a short period of time?

Thanks for the information!
Reply
#2
Yes. You can either make a service that waits for a keystroke or better make some sort of configuration in the addon prior to use in which you'll let the user decide each key to use and then make a new http://kodi.wiki/view/Keymap to a given function in your addon. Have a look at keymap editor addon by takoi to have an idea of how it can be done.

For overlays you are looking to xbmcgui.WindowXMLDialog. The function that is called to a keymap should probably define one
Reply
#3
Thank you! Do you have any good starting points for any of this?

Basically, I want to create an addon that, when a key is pressed at any time, a MP4 file plays on top of everything. The video file plays for 30 seconds and then goes away.
Reply
#4
I don't know exactly what you want to do nor your experience with addons for kodi. "Play a mp4 file on top of everything" is probably not a good explanation.
You can easily send a video to Kodi player but in this case the video is not playing on top of everything. You can still access the video osd controls (kodi will play the video no matter what you are doing though so probably this is what you mean). My understanding of "play a video on top of everything" is basically make the video play and lock down the user interface. In this case you need to mess with addon skinning which is a bit complicated for people with no prior experience with addon development (http://kodi.wiki/view/Skinning_Manual). You need to make a window xml dialog that contains a fullscreen video control (http://kodi.wiki/view/Skinning_Manual#Video_Control), activate the window and (only after this) send the video to kodi player. If the video is exactly 30 seconds you don't need to do anything else. If it is and you want to control the playback time you need to create an inheritance of the xbmc player and check the playback time in short intervals.

As for the keymap thing, have a look at keymap editor by takoi. I'm also doing something similar at the moment for one addon so I can send you the code for that part when finished.

It also depends on what the plugin is and how many people will use your plugin. If it is something just for you, you might want to skip the keymap thing and create one with the keymap editor addon. In keymap editor you can map a key to start any addon.
Reply
#5
I'm brand new to Kodi addons and know just enough Python to get by.

I have several MP4 files in a resolution of 1920x200, although just to get this working, I'm only working with one file.

Each video is a "Goal" video for a NHL team. My goal is, while you're watching the game via LiveTV or an add-on, you could press a configured key that my service would be looking for which would overlay the video on the screen without interrupting anything underneath it. The videos are roughly 30 seconds long. Pressing the same button again would stop the video and dismiss it. That's it, nothing more complicated than that.

Here is what the MP4 looks like: https://www.youtube.com/watch?v=ZKmoxpaT...e=youtu.be. Again, remember it's only 200 pixel high, so it's literally a banner video.

Hope that helps clarify my end goal. I'm working with a Hello World test service right now.
Reply
#6
Ah Big Grin that's funny Smile
I'm sorry to tell you that you can't have 2 vídeos playing at the same time in kodi, so you can only play the match or the goal advert, not both. In the best case scenario you'd have to stop the video, play yours and then start again the one that was playing before.
Reply
#7
I don't think that can be true. How do the doorbell IP camera overlay's work? My friend has this on his Kodi setup, we'll be watching a movie and if you ring his doorbell, a video overlay popups with the live video from the front door IP camera without interrupting the video. (And yes, it's a Kodi add-on for the camera overlay.)
Reply
#8
The doorbell ip camera just presents an image overlay (control image) that is updated from x to x time. It's not a video as you pretend to do with your addon.
The big majority of ipcams provide mjpeg feeds and have specific url's/"api" to grab images only. That's what that addon uses, just does it "so quickly" that makes you think it is a video.
Reply
#9
Bah, there's gotta be another way to do this. Thanks for your insight.
Reply
#10
Just a thought, since it can do images in a overlay... Will it play animated GIFs? And can it play sound while a video is playing? Big Grin
Reply
#11
It can't do animated gifs at least for now. There's a PR pending for that( see here http://forum.kodi.tv/showthread.php?tid=215727). As for sound I don't know but...I don't think so.

edit: it seems that the gifs are passed to ffmpeg/kodi player so, no luck.
Reply

Logout Mark Read Team Forum Stats Members Help
Key Listener/Overlay0