Jump to content

CHackbart

Members
  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

13 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. CHackbart

    Android TV and remote control

    const DefaultKeys: Array [0 .. 284] of integer = ( (* soft_left *) 1, (* soft_right *) 2, (* home *) 3, (* back *) 4, (* call *) 5, (* endcall *) 6, (* 0 *) 7, (* 1 *) 8, (* 2 *) 9, (* 3 *) 10, (* 4 *) 11, (* 5 *) 12, (* 6 *) 13, (* 7 *) 14, (* 8 *) 15, (* 9 *) 16, (* star *) 17, (* pound *) 18, (* dpad_up *) 19, (* dpad_down *) 20, (* dpad_left *) 21, (* dpad_right *) 22, (* dpad_center *) 23, (* volume_up *) 24, (* volume_down *) 25, (* power *) 26, (* camera *) 27, (* clear *) 28, (* a *) 29, (* b *) 30, (* c *) 31, (* d *) 32, (* e *) 33, (* f *) 34, (* g *) 35, (* h *) 36, (* i *) 37, (* j *) 38, (* k *) 39, (* l *) 40, (* m *) 41, (* n *) 42, (* o *) 43, (* p *) 44, (* q *) 45, (* r *) 46, (* s *) 47, (* t *) 48, (* u *) 49, (* v *) 50, (* w *) 51, (* x *) 52, (* y *) 53, (* z *) 54, (* comma *) 55, (* period *) 56, (* alt_left *) 57, (* alt_right *) 58, (* shift_left *) 59, (* shift_right *) 60, (* tab *) 61, (* space *) 62, (* sym *) 63, (* explorer *) 64, (* envelope *) 65, (* enter *) 66, (* del *) 67, (* grave *) 68, (* minus *) 69, (* equals *) 70, (* left_bracket *) 71, (* right_bracket *) 72, (* backslash *) 73, (* semicolon *) 74, (* apostrophe *) 75, (* slash *) 76, (* at *) 77, (* num *) 78, (* headsethook *) 79, (* focus *) 80, (* plus *) 81, (* menu *) 82, (* notification *) 83, (* search *) 84, (* media_play_pause *) 85, (* media_stop *) 86, (* media_next *) 87, (* media_previous *) 88, (* media_rewind *) 89, (* media_fast_forward *) 90, (* mute *) 91, (* page_up *) 92, (* page_down *) 93, (* pictsymbols *) 94, (* switch_charset *) 95, (* button_a *) 96, (* button_b *) 97, (* button_c *) 98, (* button_x *) 99, (* button_y *) 100, (* button_z *) 101, (* button_l1 *) 102, (* button_r1 *) 103, (* button_l2 *) 104, (* button_r2 *) 105, (* button_thumbl *) 106, (* button_thumbr *) 107, (* button_start *) 108, (* button_select *) 109, (* button_mode *) 110, (* escape *) 111, (* forward_del *) 112, (* ctrl_left *) 113, (* ctrl_right *) 114, (* caps_lock *) 115, (* scroll_lock *) 116, (* meta_left *) 117, (* meta_right *) 118, (* function *) 119, (* sysrq *) 120, (* break *) 121, (* move_home *) 122, (* move_end *) 123, (* insert *) 124, (* forward *) 125, (* media_play *) 126, (* media_pause *) 127, (* media_close *) 128, (* media_eject *) 129, (* media_record *) 130, (* f1 *) 131, (* f2 *) 132, (* f3 *) 133, (* f4 *) 134, (* f5 *) 135, (* f6 *) 136, (* f7 *) 137, (* f8 *) 138, (* f9 *) 139, (* f10 *) 140, (* f11 *) 141, (* f12 *) 142, (* num_lock *) 143, (* numpad_0 *) 144, (* numpad_1 *) 145, (* numpad_2 *) 146, (* numpad_3 *) 147, (* numpad_4 *) 148, (* numpad_5 *) 149, (* numpad_6 *) 150, (* numpad_7 *) 151, (* numpad_8 *) 152, (* numpad_9 *) 153, (* numpad_divide *) 154, (* numpad_multiply *) 155, (* numpad_subtract *) 156, (* numpad_add *) 157, (* numpad_dot *) 158, (* numpad_comma *) 159, (* numpad_enter *) 160, (* numpad_equals *) 161, (* numpad_left_paren *) 162, (* numpad_right_paren *) 163, (* volume_mute *) 164, (* info *) 165, (* channel_up *) 166, (* channel_down *) 167, (* zoom_in *) 168, (* zoom_out *) 169, (* tv *) 170, (* window *) 171, (* guide *) 172, (* dvr *) 173, (* bookmark *) 174, (* captions *) 175, (* settings *) 176, (* tv_power *) 177, (* tv_input *) 178, (* stb_power *) 179, (* stb_input *) 180, (* avr_power *) 181, (* avr_input *) 182, (* prog_red *) 183, (* prog_green *) 184, (* prog_yellow *) 185, (* prog_blue *) 186, (* app_switch *) 187, (* button_1 *) 188, (* button_2 *) 189, (* button_3 *) 190, (* button_4 *) 191, (* button_5 *) 192, (* button_6 *) 193, (* button_7 *) 194, (* button_8 *) 195, (* button_9 *) 196, (* button_10 *) 197, (* button_11 *) 198, (* button_12 *) 199, (* button_13 *) 200, (* button_14 *) 201, (* button_15 *) 202, (* button_16 *) 203, (* language_switch *) 204, (* manner_mode *) 205, (* 3d_mode *) 206, (* contacts *) 207, (* calendar *) 208, (* music *) 209, (* calculator *) 210, (* zenkaku_hankaku *) 211, (* eisu *) 212, (* muhenkan *) 213, (* henkan *) 214, (* katakana_hiragana *) 215, (* yen *) 216, (* ro *) 217, (* kana *) 218, (* assist *) 219, (* brightness_down *) 220, (* brightness_up *) 221, (* media_audio_track *) 222, (* sleep *) 223, (* wakeup *) 224, (* pairing *) 225, (* media_top_menu *) 226, (* 11 *) 227, (* 12 *) 228, (* last_channel *) 229, (* tv_data_service *) 230, (* voice_assist *) 231, (* tv_radio_service *) 232, (* tv_teletext *) 233, (* tv_number_entry *) 234, (* tv_terrestrial_analog *) 235, (* tv_terrestrial_digital *) 236, (* tv_satellite *) 237, (* tv_satellite_bs *) 238, (* tv_satellite_cs *) 239, (* tv_satellite_service *) 240, (* tv_network *) 241, (* tv_antenna_cable *) 242, (* tv_input_hdmi_1 *) 243, (* tv_input_hdmi_2 *) 244, (* tv_input_hdmi_3 *) 245, (* tv_input_hdmi_4 *) 246, (* tv_input_composite_1 *) 247, (* tv_input_composite_2 *) 248, (* tv_input_component_1 *) 249, (* tv_input_component_2 *) 250, (* tv_input_vga_1 *) 251, (* tv_audio_description *) 252, (* tv_audio_description_mix_up *) 253, (* tv_audio_description_mix_down *) 254, (* tv_zoom_mode *) 255, (* tv_contents_menu *) 256, (* tv_media_context_menu *) 257, (* tv_timer_programming *) 258, (* help *) 259, (* navigate_previous *) 260, (* navigate_next *) 261, (* navigate_in *) 262, (* navigate_out *) 263, (* stem_primary *) 264, (* stem_1 *) 265, (* stem_2 *) 266, (* stem_3 *) 267, (* dpad_up_left *) 268, (* dpad_down_left *) 269, (* dpad_up_right *) 270, (* dpad_down_right *) 271, (* media_skip_forward *) 272, (* media_skip_backward *) 273, (* media_step_forward *) 274, (* media_step_backward *) 275, (* soft_sleep *) 276, (* cut *) 277, (* copy *) 278, (* paste *) 279, (* system_navigation_up *) 280, (* system_navigation_down *) 281, (* system_navigation_left *) 282, (* system_navigation_right *) 283, (* all_apps *) 284, (* refresh *) 285); .. if TPlatformServices.Current.SupportsPlatformService(IFMXKeyMappingService, KeyMappingService) then begin for i := 0 to high(DefaultKeys) do KeyMappingService.RegisterKeyMapping(DefaultKeys[i], DefaultKeys[i], TKeyKind.Usual); end; Thanks, I use the code above which seem to work fine with the remotes.
  2. CHackbart

    Android TV and remote control

    Hi, i am a bit clueless. All the buttons on the remote are not detected, except the cursor keys. My code is quite simple: protected procedure IsDialogKey(const Key: Word; const KeyChar: WideChar; const Shift: TShiftState; var IsDialog: Boolean); override; public ... procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: WideChar; Shift: TShiftState); begin SendKey(Key, KeyChar); end; procedure TForm1.IsDialogKey(const Key: Word; const KeyChar: WideChar; const Shift: TShiftState; var IsDialog: Boolean); begin SendKey(Key, KeyChar); inherited; end; procedure TForm1.SendKey(const AKey: Word; const AKeyChar: WideChar); begin Label1.Text := format('%d - %s (%d)', [AKey, AKeyChar, ord(AKeyChar)]); end; The form only has a Label. I got a IsDialogKey event triggered when pressing, but Key and AKeyChar are 0 in every case - except when the cursor keys are pressed. Does someone have an idea? When I set a breakpoint at function TAndroidTextInputManager.HandleAndroidKeyEvent(AEvent: PAInputEvent): Int32; I see that my keys are detected well, but got lost in PlatformKeyToVirtualKey *wth*. I have to register all keys which are available for this certain platform. Christian
  3. CHackbart

    Pop3 and TLS1.2 in Indy 10

    I now get some error messages on certain accounts with "invalid sequence number". I never saw this before. Nevermind I found the problem.
  4. CHackbart

    Pop3 and TLS1.2 in Indy 10

    Wow, this was quick. Thanks Pop.UseTLS := utUseImplicitTLS; works 🙂 Christian
  5. CHackbart

    Pop3 and TLS1.2 in Indy 10

    Hi, this might sound stupid, but it has been a while since I touched this particular code. Somehow connect fails gracefully. The old code was working since ages, but the provider (ionos) switched to TLS 1.2. So I changed my code into: POP := TIdPOP3.Create(nil); SSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil); SSL.SSLOptions.Method := sslvTLSv1_2; POP.IOHandler := SSL; //SSL Pop.Port := 995; I use openssl-1.0.2u-i386-win32 for OpenSSL. Does somebody have an idea? Christian
  6. CHackbart

    TestFlight problems

    Thanks, for the hint. I managed to do this and the Transporter App does not complain it anymore. Besides this under TestFlight I get a "Not Available for Testing". Christian
  7. CHackbart

    TestFlight problems

    Hi, i have a problem when i try to publish an application. I upload it via Transporter, but it complains the following: "Cannot be used with TestFlight because the bundle at “Appname.app” is missing a provisioning profile. Main bundles are expected to have provisioning profiles in order to be eligible for TestFlight." (90889) I have no idea what I do wrong, I set it up correctly, and also tried to sign It by hand via: codesign -f -v -s "3rd Party Mac Developer Application" Appname.app productbuild --component "Appname.app" /Applications --sign "3rd Party Mac Developer Installer:" --product "Appname.app/Contents/info.plist" Appname.pkg Does someone have an idea what I missed? Christian
  8. CHackbart

    TSocket and UDP

    Hi, does somebody know if there is an example how to use the System.Net.Socket in combination with UDP? In the past I used synapse for this, but prefer in order to simplify my code use something which is officially supported on all platforms. What I did till now is the following: 1. I collect the available network devices via: procedure GetLocalIPs(iplist: TStrings; ipfamily: Integer); var TcpSock: TTCPBlockSocket; begin TcpSock := TTCPBlockSocket.create; case ipfamily of 1 : TcpSock.family:=SF_IP4; 2 : TcpSock.family:=SF_IP6; end; try TcpSock.ResolveNameToIP(TcpSock.LocalName, ipList); finally TcpSock.Free; end; end; 2. I create a TUDPBlockSocket using: Result := TUDPBlockSocket.Create(); Result.bind(aIP, '0'); Result.Connect('239.255.255.250', '1900'); resp. Result := TUDPBlockSocket.Create(); Result.EnableReuse(True); Result.bind(aIP, '1900'); Result.MulticastTTL := 5; Result.AddMulticast('239.255.255.250'); 3. These sockets where hosted in a TSocketList which I used to check if data is available using: if FSocketList[0].GroupCanRead(fSockets, ftimeout, fActive) then This worked well, but I would like to replace the whole code using the official Socket implementation instead. Anyhow I do not find a proper explanation how to use TSocket.Create(TSocketType.UDP, TEncoding.UTF8). So if there is somebody who could point my nose to some code snippets, this would be great. I neither know how to get a list of the available network devices, nor how to bind the sockets or to send a request to socket I created first at step 2 Cheers Christian
  9. CHackbart

    Stacking FMX components over native elements

    I think you are right, I read a bit about the TControlType. In theory I could put a TPanel as parent of my OSD on top of the browser/video player. This works on Windows, for Mac I move the browser/video view in the context video and not the form nsview. Anyhow this works at the moment here, but I have to figure out how to hook WM_ERASEBKGND for the panel in order to make it transparent, Cheers Christian
  10. CHackbart

    Stacking FMX components over native elements

    Hi, thanks I voted for your issue - even if I am not sure if it helps. I would love to test that, but I assume it probably won't work in my case. The project I am working is an iptv application which heavily uses DRM, so I was forced to use the AVFoundation classes under MacOS and since Microsoft somehow did not support Playready properly for Win32/Win64 I was forced to use Widevine in combination with Edge as player under windows. Both are working fine but suck when you try to use FMX controls on top as overlay. Since I use a browser under windows, I thought it might be cool to add HbbTV (some sort of interactive content for tv) to the streams and after I got this working I thought it would be nice to have this also running on a Mac.
  11. Hi, i was trying to handle the following issue: I want to render FMX components over native components like the Webbrowser. To do so I wrote a TLayout class which has a transparent form. This form will be drawn over the original position. This works reasonably well under windows, but fails under MacOS. Technically I put the NSView of the new form in the context of the old form, but on top. This works fine, but all the elements are not clickable. Has somebody an idea how to solve this? For FMX.Media.Mac you can easily put the video in the context before the LFormView, like: LFormView := WindowHandleToPlatform(LForm.Handle).View; LContext := TNSView.Wrap(WindowHandleToPlatform(LForm.Handle).Wnd.contentView); LContext.addSubview(FVideoView); LContext.addSubview(LFormView); unit FMX.LayoutForm; interface uses System.Classes, FMX.Types, FMX.Layouts, FMX.Forms {$IFDEF MSWINDOWS}, Winapi.Windows, Winapi.Messages{$ENDIF}; type TVirtualLayout = class(TLayout) protected FView: TForm; {$IFDEF MSWINDOWS} FObjectInstance: Pointer; FDefWindowProc: Pointer; FWndHandle: HWND; procedure MainWndProc(var Message: TMessage); procedure UpdateBounds; {$ENDIF} procedure DoResized; override; procedure SetParent(const Value: TFmxObject); override; public constructor Create(AOwner: TComponent); override; destructor Destroy(); override; end; implementation uses System.Types {$IFDEF MSWINDOWS}, FMX.Platform.Win {$ENDIF} {$IFDEF MACOS}, Macapi.AppKit, FMX.Platform.Mac {$ENDIF}; constructor TVirtualLayout.Create(AOwner: TComponent); begin inherited; FView := TForm.CreateNew(nil); FView.BorderStyle := TFmxFormBorderStyle.None; FView.Transparency := true; FView.Name := 'TOSDWindow'; end; destructor TVirtualLayout.Destroy(); begin {$IFDEF MSWINDOWS} if FDefWindowProc <> nil then begin SetWindowLong(FWndHandle, GWL_WNDPROC, IntPtr(FDefWindowProc)); FDefWindowProc := nil; end; if FObjectInstance <> nil then begin FreeObjectInstance(FObjectInstance); FObjectInstance := nil; end; {$ENDIF} inherited; end; {$IFDEF MSWINDOWS} procedure TVirtualLayout.UpdateBounds; var LForm: TCommonCustomForm; R: TRectF; begin if FView.Parent is TCommonCustomForm then begin LForm := TCommonCustomForm(FView.Parent); R := LForm.ClientRect; R.Offset(LForm.ClientToScreen(PointF(0, 0))); FView.SetBoundsF(R); end; end; procedure TVirtualLayout.MainWndProc(var Message: TMessage); begin if Root.GetObject is TCommonCustomForm then begin if Message.Msg = WM_MOVE then begin UpdateBounds; end; if (Message.Result = 0) then TCommonCustomForm(Root.GetObject).Dispatch(Message); with Message do begin if Result = 0 then Result := CallWindowProc(FDefWindowProc, FWndHandle, Msg, WParam, LParam); end; end; end; {$ENDIF} procedure TVirtualLayout.SetParent(const Value: TFmxObject); begin inherited; {$IFDEF MSWINDOWS} FreeObjectInstance(FObjectInstance); FObjectInstance := nil; DoResized; {$ENDIF} end; procedure TVirtualLayout.DoResized; var LForm: TCommonCustomForm; {$IFDEF MACOS} LVideoView: NSView; LFormView: NSView; LContext: NSView; {$ENDIF} i: integer; begin inherited; if not(csDesigning in ComponentState) and (ParentedVisible) and (Root <> nil) and (Root.GetObject is TCommonCustomForm) then begin for i := ChildrenCount - 1 downto 0 do if (Children[i].Name <> '') then Children[i].Parent := FView; LForm := TCommonCustomForm(Root.GetObject); FView.Visible := true; FView.StyleBook := LForm.StyleBook; FView.OnKeyUp := LForm.OnKeyUp; FView.OnKeyDown := LForm.OnKeyDown; FView.OnMouseDown := LForm.OnMouseDown; FView.OnMouseMove := LForm.OnMouseMove; FView.OnMouseUp := LForm.OnMouseUp; FView.OnMouseWheel := LForm.OnMouseWheel; {$IFDEF MACOS} LFormView := WindowHandleToPlatform(LForm.Handle).View; LVideoView := WindowHandleToPlatform(FView.Handle).View; LContext := TNSView.Wrap(WindowHandleToPlatform(LForm.Handle) .Wnd.contentView); LContext.addSubview(LFormView); LContext.addSubview(LVideoView); {$ENDIF} {$IFDEF MSWINDOWS} if FObjectInstance = nil then begin FObjectInstance := MakeObjectInstance(MainWndProc); if FObjectInstance <> nil then begin FWndHandle := WindowHandleToPlatform(LForm.Handle).Wnd; FDefWindowProc := Pointer(GetWindowLong(FWndHandle, GWL_WNDPROC)); SetWindowLong(FWndHandle, GWL_WNDPROC, IntPtr(FObjectInstance)); end; end; {$ENDIF} end else begin for i := FView.ChildrenCount - 1 downto 0 do if (FView.Children[i].Name <> '') then FView.Children[i].Parent := self; FView.Parent := nil; FView.Visible := false; end; end; end.
  12. Hi, I started create a simple media player based on the Windows Media Foundation. I have to deal with DRM encrypted channels so there is unluckily no way around. Did somebody have some experience with the Windows Media Foundation and DRM? The attached demo is a player using WMF and Firemonkey. The header files used in this project can be found here: https://github.com/FactoryXCode/MfPack You should be able to play streams (based on dash and HLS) as well as media files located on the local file system. It partially crashes here on my vm inside the the d3d11.dll. I did not tested it on a native windows system yet. The player also uses some "technique" to render firemonkey elements on top of the video. To do so you just have to put them as child object to the player. Christian fmxwmf.zip
  13. CHackbart

    MacOS NSVisualEffectView implementation

    I will create a small GitHub repo with those helpers. Especially the Z-Order handling is something I barely miss under MacOS. By removing the contentView and adding it after the other views have been added to the MainView you can easily put the FMX layer to the top.
  14. CHackbart

    MacOS NSVisualEffectView implementation

    Yes, and it works surprisingly well. You just have to execute AppendToForm with your Formular and if you do not want to have a border - since FireMonkey still is unable to render the toolbar with a style under osx - you can set this also to borderless. function AppendToForm(const AForm: TForm;const AOpacity: single=1.0;const ABorderLess: Boolean=False): Boolean; var LNSWin: NSWindow; LBlurView: NSVisualEffectView; LView: NSView; LContext: NSView; begin if not TOSVersion.Check(10,10) then begin result := false; exit; end; AForm.Fill.Kind := TBrushKind.Solid; AForm.Fill.Color := 0; LNSWin := WindowHandleToPlatform(AForm.Handle).Wnd; LContext := WindowHandleToPlatform(AForm.Handle).View; LNSWin.setOpaque(false); LNSWin.setAlphaValue(AOpacity); LBlurView := TNSVisualEffectView.Wrap( TNSVisualEffectView.Alloc.initWithFrame( MakeNSRect(0,0, AForm.Width, AForm.Height))); LBlurView.setWantsLayer(true); LBlurView.setBlendingMode(NSVisualEffectBlendingModeBehindWindow); LBlurView.setMaterial(NSVisualEffectViewMaterialFullScreenUI); LBlurView.setState(NSVisualEffectStateActive); LBlurView.setAutoresizingMask(NSViewWidthSizable or NSViewHeightSizable); LView := TNSView.Wrap(LNSWin.contentView); if ABorderLess then begin LNSWin.setStyleMask(NSBorderlessWindowMask or NSResizableWindowMask); LNSWin.setBackgroundColor(TNSColor.Wrap(TNSColor.OCClass.clearColor)); LView.setWantsLayer(true); LView.layer.setMasksToBounds(true); LView.layer.SetCornerRadius(10.0); end; LContext.removeFromSuperview; LView.addSubview(LBlurView); LView.addSubview(LContext); if GlobalUseMetal then WindowHandleToPlatform(AForm.Handle).MTView.layer.setOpaque(false); result := true; end;
  15. CHackbart

    MacOS NSVisualEffectView implementation

    I managed to get it working. To do so I had to move the main view to the front and set the background color of the layer to transparent. This works also when UseGlobalMetal is enabled.
Ă—