Amazon Prime Germany? (4 Viewers)

JSurf

Portal Pro
November 27, 2011
115
115
47
Home Country
Germany Germany
After starting the video none of the keys worked. I clicked into the player with the mouse and then the the keys started working. Have a dual monitor setup here, and the playback started on the 2nd monitor. Will also test at home with my laptop

My current version is based on svn commit 3481
 

Jason Pyke

Portal Pro
April 12, 2013
96
38
Home Country
Great Britain (UK) Great Britain (UK)
Hmmm, that's odd - the code does do a mouse click into the player first and then sends the keys.

It's difficult for me to debug here because I don't have prime. When you get a chance maybe set the browserhost to debug mode and add
MessageHandler.Debug messages into the DoPlayOrPause of the AmazonPrimeConnector. These messages will be written to the path in the browser host config. It's probably just a case of tweaking these few lines (in both DoPlayOrPause and OnAction):

Cursor.Position = new System.Drawing.Point(300, 300);
Application.DoEvents();
CursorHelper.DoLeftMouseClick();
Application.DoEvents();
System.Windows.Forms.SendKeys.Send(" ");
 

JSurf

Portal Pro
November 27, 2011
115
115
47
Home Country
Germany Germany
Ok thats what i got now. Once i made sure the browser control runs on the first monitor it started partly working.
ESC-Key - Works
left/right - Works

Space - First "space" works but then double events occur. I think there are two events happening. The "space"-keypress event itself sends one event to the player directly somehow bypassing the browserhost code, and then a second event is sent by the "doplayorpause" function, thats my theory

In debug mode the following is possible:
1. Click another window, not the browserhost so browserhost window looses focus
2. Click the titlebar of the browserhost window, so it has focus but the player is not clicked
3. press space -> working as expected
4. press space a second time-> double event (repeat 4. as often as you like -> double event)
5. Goto 1.[DOUBLEPOST=1421336181][/DOUBLEPOST]Actually it looks like we get three eventswhen it is working, and two events when it is not working

Log for 3.
15 Jan 2015 16:33:15 HandleKeyPress to be processed 32
15 Jan 2015 16:33:15 OnNewAction received ACTION_PAUSE
15 Jan 2015 16:33:15 OnNewAction received ACTION_PLAY


Log for 4.
15 Jan 2015 16:33:40 HandleKeyPress to be processed 32
15 Jan 2015 16:33:40 OnNewAction received ACTION_PAUSE
 
Last edited:

Jason Pyke

Portal Pro
April 12, 2013
96
38
Home Country
Great Britain (UK) Great Britain (UK)
OK, that sounds promising and the space double press is entirely feasible. I know @Ministerk uses a similar technique for the Netflix connector (which is where I copied the code from), but I'm not sure how he's got round this double press issue.

I guess the code which I added to set the browser form to have to focus after pausing/playing isn't having an effect and I guess you've reduced the frequency of the timerCtl as well (which is there to make sure the form has focus).

Maybe try handling the got focus event of the browser and maybe set the focus back to the form at that point? (after playback has started). It'd be ideal if we could actually get the state of playback (using javascript or something) and work it from there, but I'm not sure how feasible that is.[DOUBLEPOST=1421338329][/DOUBLEPOST]Those difference in events are possibly not relevant because looking through the code I think it'll only call play/pause in the connector once in both cases. Maybe you could add a logging line to the play and pause events in the connector (MessageHandler.Debug) and see what that reports as coming through.
 
Last edited:

Ministerk

Super User
  • Team MediaPortal
  • Super User
  • November 28, 2007
    970
    826
    Uppsala
    Home Country
    Sweden Sweden
    I know @Ministerk uses a similar technique for the Netflix connector (which is where I copied the code from), but I'm not sure how he's got round this double press issue.

    I think I go around the double press issue by clicking with the mouse before sending keys. The Netflix silverlight player gets focus and not the browser player. I'm certain you both experienced the problem with closing browser tabs with ctrl+w because the video player has focus and not the browser tab.
     

    Jason Pyke

    Portal Pro
    April 12, 2013
    96
    38
    Home Country
    Great Britain (UK) Great Britain (UK)
    I copied your code for doing that and I think it's working. The problem here is that if you use the space key for play/pause, it most of the time sends that to Silverlight to play/pause and then it goes through the browser host to send the same key again. I'm thinking there must be a way of stopping Silverlight ever having focus, but as I don't have access to Prime right now I can't test it out.

    Maybe I'll see if they'll give me another free trial.
     

    Ministerk

    Super User
  • Team MediaPortal
  • Super User
  • November 28, 2007
    970
    826
    Uppsala
    Home Country
    Sweden Sweden
    I'm thinking there must be a way of stopping Silverlight ever having focus
    For me (Netflix) needs to have focus on the silverlight player for kea strokes, otherwise I have to resort to finding play/pause button and clock with mouse (not fixed positioned). Forward and rewind functionality would have to be dropped. Could this be a site setting if you need it not to have focus?
     

    JSurf

    Portal Pro
    November 27, 2011
    115
    115
    47
    Home Country
    Germany Germany
    Had a look at the javascript-API of the player yesterday.

    - There is a pause function that works perfectly amzn.webGlobalVideoPlayer._mainPlayer.pause();
    - There is a status function amzn.webGlobalVideoPlayer._mainPlayer.getStatus();

    Unfortunately there is no play/resume function that works as expected. There are around 4 functions that do a "play" but they all restart the player completely with buffering. There is also a parameter called createNewPlayerObject on some of the play methods but even setting this to false has no effect.
     

    Users who are viewing this thread

    Similar threads

    • Sticky
    Software Developer C# The MediaPortal 2 team is seeking committed people to strengthen its developer basis Are you interested in driving the development of an advanced HTPC software? Would you like new features get implemented faster? Well, then join us! What we offer: Almost unlimited creative leeway The possibility to closely...
    Software Developer C# The MediaPortal 2 team is seeking committed people to strengthen its developer basis Are you interested in...
    Software Developer C# The MediaPortal 2 team is seeking committed people to strengthen its developer basis Are you interested in...
    Replies
    0
    Views
    6K
    Once I get back home, I'll try that. Thanks!
    Once I get back home, I'll try that. Thanks!
    My mini computer HTPC was doing a fine job running mediaportal, but the internal fan is starting to get very loud. I'd like to...
    Replies
    11
    Views
    1K
    Yes, all compatible with x64 ;)
    Yes, all compatible with x64 ;)
    Hi folks, for all those who would like to enjoy Mediaportal on the Titanskin, I have now adapted the well-known MP games package...
    Replies
    7
    Views
    425
    @Brownard another logs of failed installations. I'll take a look into the user management. Edit: I can confirm user management is completey broken with NET4 and NET6 :( Neither an existing profile can be selected nor a new one can be created.
    @Brownard another logs of failed installations. I'll take a look into the user management. Edit: I can confirm user management is...
    Description: Hi there. First of all, I appreciate all the effort in MediaPortal 2 release 2.5 - visible changes look great (eg...
    Replies
    1
    Views
    868
    The UseSSL trick made MediaPortal great again, thanks.
    The UseSSL trick made MediaPortal great again, thanks.
    Hi, Trakt has work perfectly for me for over 10 years, but for some reason this week it will not Authorize my account. I can log...
    Replies
    10
    Views
    668
    Top Bottom