A Fuse Powered Company

Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Fire TV Owners - Please Read
Started by roaminggamer Apr 21 2014 11:17 AM

15 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 1,180 posts
  • Enterprise

Hi!  Do you have a Fire TV?  Do you know how side-load apps to your device?

 

If you said "Yes" to both of these questions, I need your help.

 

I have an app: HERE that will dump the key-codes for the basic FTV controller.

 

I need folks to do the following:

 

1. Download the app.

2. Install in on your FTV

3. Run it.

4. Press all of the buttons as shown (except home and microphone) at least three times.

5. Take a digital photo of your screen.

6. Post the image here.

 

 

Why do I need this?  Well, I want to make a small module to convert FTV key inputs to useful events for games and apps.  

 

When I get this done, I'll release it for free to the community as well as use it myself.

 

So, if you can please help.

 

I only need a few people to do this.

 

Thanks,

 

Ed

InputTest.jpg



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 1,180 posts
  • Enterprise

All,

 

I got the results I needed and will be writing up a small drop-in library to allow easy mapping of the 'standard' Fire TV controller.

 

If someone out there has the game controller for the Fire TV and wants to help me test the mapping for that, please write back here.

 

-Ed



[TOPIC: post.html]
#3

GP Animations

[GLOBAL: userInfoPane.html]
GP Animations
  • Enthusiast

  • 91 posts
  • Enterprise

[TOPIC: post.html]
#4

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Wow! Congratulations to both! This is impressive. 



[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 1,180 posts
  • Enterprise

@All,

 

Hi again.  The 'library' is done and you can find it as well as an example (verify/ folder) of it here:

 

https://github.com/roaminggamer/RG_FreeStuff/tree/master/FireTVLib

 

 

I'll be doing a Fire TV game controller version when I get the time.

 

Cheers,

 

Ed



[TOPIC: post.html]
#6

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 2,862 posts
  • Corona Staff

Corona actually provides an "event.keyName" which provides a consistent string key that you can use instead of using the native key code.  That is, we've already done the work for you to bind native key codes to a cross-platform string key.

   http://docs.coronalabs.com/api/event/key/keyName.html

 

This is supported on both Android and Windows.

 

I think Mac is the only platform where Corona does not provide consistent key names... which is on our to-do list to resolve later.

(Or perhaps Mac is the reason why you went out of your way to make your own key binding library?)



[TOPIC: post.html]
#7

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 1,180 posts
  • Enterprise

@All,

 

Joshua is completely right and I have made some small changes to the library to make them consistent with the keynames used by Corona.  However, I'm sticking with the native key codes because, I wanted to do something a little different from the normal onKey() processing.

 

  • My lib extends the default onKey() processing and doesn't override or replace it.
  • My lib makes a small change from onKey().  Instead of the phases: "up" and "down", I've remapped to the "began" and "ended".  I figured folks would be used to these as they are two of the the standard 'touch' phases.
  • My lib only listens for these FireTV keys: menu, back, mediaFastForward, mediaRewind, mediaPlayPause, left, right, up, down, select
  • My lib remaps these keys on Windows and OS X machines to produce FireTV input (like) events to enable FireTV app testing in the simulator:
    • m - menu
    • b - back
    • f - mediaFastForward
    • r - mediaRewind
    • p - mediaPlayPause
    • left - left 
    • right - right
    • up - up
    • down - down
    • s - select 

 

Note: If the above seems at all defensive, please don't think of it that way.  It's always hard to read tone in forums and what-not.  I am simply elaborating on the reasoning and differences between a standard onKey() approach vs. mine.  

 

Actually, Joshua guessed correctly.  OS X was the trouble maker for easy mapping and I borrowed from an old remapping lib of mine (RGEasyKeys) to make this lib.  Just goes to show the Corona staff are smart and can often guess why we developers do weird things.  :) 

 

On a last note, in addition to the keyName corrections, I've added a Composer Framework example that uses the Fire TV lib and touch inputs to navigate.

 

 

(First half of video is 'verify' app, second half is composer framework with Fire TV inputs, tested in simulator.)

 

Cheers!



[TOPIC: post.html]
#8

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 2,862 posts
  • Corona Staff

Sounds good.  I often wrap a system's functionality with my own classes in case I need to do my own custom handling.  So, I think what you are doing is perfectly reasonable.  I just wanted to make sure you were aware of the functionality that Corona provided in case it could save you some work/time.



[TOPIC: post.html]
#9

prmobiapp

[GLOBAL: userInfoPane.html]
prmobiapp
  • Enthusiast

  • 49 posts
  • Enterprise

Ed, Could you please share me the "Fire TV game controller version" key event for A, B, X and Y? If possible L1, L2, R1 and R2? Thanks!



[TOPIC: post.html]
#10

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 1,180 posts
  • Enterprise

Hi all.  I dropped the ball on this and need to finish it up.  

 

I went on vacation and the got really busy with client work when I returned.  

 

However, I will be bringing out some Fire TV games later this month and the work will get finished then.  I'll share when I have the module working.

 

-Ed



[TOPIC: post.html]
#11

schizoid2k

[GLOBAL: userInfoPane.html]
schizoid2k
  • Contributor

  • 335 posts
  • Enterprise

Dredging up an old topic...

 

Is there a list of key codes for the Fire TV joystick available somewhere?



[TOPIC: post.html]
#12

schizoid2k

[GLOBAL: userInfoPane.html]
schizoid2k
  • Contributor

  • 335 posts
  • Enterprise

I guess I know my answer.  :(



[TOPIC: post.html]
#13

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 2,862 posts
  • Corona Staff

You can use Corona's "key" event's "keyName" string property to identify what was pressed.  The key names do actually match what is pressed on an Amazon Fire gamepad.  So, you'll get the following...

 

A button keyName:  "buttonA"

B button keyName:  "buttonB"

X button keyName:  "buttonX"

Y button keyName:  "buttonY"

L1 left shoulder button keyName:  "leftShoulderButton1"

R1 right shoulder button keyName:  "rightShoulderButton1"

Left stick button keyName:  "leftJoystickButton"  (This is when you click down on the analogue stick.)

Right stick button keyName:  "rightJoystickButton"  (This is when you click down on the analogue stick.)

Menu button keyName:  "menu"

Back button keyName:  "back"

Play/Pause button keyName:  "mediaPlayPause"

Rewind button keyName:  "mediaRewind"

Fast forward button keyName:  "mediaFastForward"

Dpad up/down/left/right keyNames:  "up", "down", "left", "right" respectively

 

If you are after the native key codes, then what you can do is look up which Android Java constants are assigned to which buttons in Amazon's documentation here...

   https://developer.amazon.com/public/solutions/devices/fire-tv/docs/amazon-fire-game-controller-input#Input%20Event%20Reference

 

...and then cross-reference them in Google's documentation via the link below to see what unique integer ID is assigned to each constant, such as their KEYCODE_BUTTON_A constant.

   http://developer.android.com/reference/android/view/KeyEvent.html

 

Or another solution is to just print() the native key code for yourself view what the actually ID is via "adb logcat".

 

I hope this helps!



[TOPIC: post.html]
#14

schizoid2k

[GLOBAL: userInfoPane.html]
schizoid2k
  • Contributor

  • 335 posts
  • Enterprise

Awesome!  I was interested in the event.keyName strings.  I didn't think it was that simple, and since I currently do not have a joystick to test (yet), I wanted/needed something in order to start getting my app ready for Amazon TV.

 

Thanks Josh!  This helps a lot.



[TOPIC: post.html]
#15

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 2,862 posts
  • Corona Staff

Happy to help.  And just to give you some forewarning, end-users can connect non-Amazon gamepads to the Fire TV... such as a PS3 or Ouya gamepad.  An Android device will actually accept any bluetooth device that supports the HID protocol.  This includes bluetooth mice and keyboards as well.  So, you might want to consider setting up a key/button mapping screen in your app as well, like how many PC games do it.  I'm sure Amazon's reviewers would be fine with your app only supporting their gamepads, but the ability to support other gamepads too would add extra polish that I'm sure your customers would like.



[TOPIC: post.html]
#16

schizoid2k

[GLOBAL: userInfoPane.html]
schizoid2k
  • Contributor

  • 335 posts
  • Enterprise

Good to know!  I have PS3 and PS4 controllers, so I can give it a try.




[topic_controls]
[/topic_controls]