[Help] with Overbyte with RVMedia and streaming microphone data to all connected clients.

RVMedia support and discussion (components for displaying and controlling IP cameras, webcams, video conferencing, video chats, recording audio and video files)
Post Reply
WpgnGaming
Posts: 20
Joined: Mon Dec 21, 2015 7:54 pm

[Help] with Overbyte with RVMedia and streaming microphone data to all connected clients.

Post by WpgnGaming »

OK am trying to work out away to use overbyte to stream the audio data from RVMicrophone and then replace it back using RVAudioPlayer on the other clients.

but am finding it a little tricky and there no demo on how to stream via internet but I done some thing like this as a example of my idea

Send data to server

Code: Select all

procedure TForm1.RVMicrophone1GetAudio(Sender: TObject; AStream: TMemoryStream;
  var ADataSize: Integer; const AAudioIndex: Word; var AStartTime,
  ADuration: Cardinal; var ASamplesPerSec: TRVSamplesPerSec;
  var ABitsPerSample: TRVBitsPerSample; var AChannels: Integer);
begin
  AStream.Position := 0;
  WSocket1.Send(AStream, AStream.Size); // send to overbyte socket server
end;
Server gets data and then send it back to client

Code: Select all

procedure TForm1.WSocketServer1DataAvailable(Sender: TObject; ErrCode: Word);
var
   AStream: TMemoryStream;
begin
    AStream := TMemoryStream.Create();
    WSocketServer1.Receive(AStream, AStream.Size);
    AStream.Position := 0;
    WSocketServer1.Client[0].Send(AStream, AStream.Size); // sent to overbyte client scoket
end;
Client plays back the audio

Code: Select all

procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
var
    AStream: TMemoryStream;
begin
    AStream := TMemoryStream.Create();
    WSocket1.Receive(AStream, AStream.Size);
    AStream.Position := 0;
    RVAudioPlayer1.PlayAudio(AStream,AStream.Size); // add to player so clients can hear incoming audio
end;
now all that code is just a mock up and more then likely will not work but it gives you a general understanding what am after. and sorry for any bad spelling :D
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: [Help] with Overbyte with RVMedia and streaming microphone data to all connected clients.

Post by Sergey Tkachenko »

TRVAudioPlayer really has PlayAudio method, but it has more parameters:

Code: Select all

procedure PlayAudio(AStream : TMemoryStream;
      var ADataSize : Integer; AGUID : TGUID; const AAudioIndex : Word;
      var AStartTime, ADuration : Longword;
      var ASamplesPerSec : TRVSamplesPerSec;
      var ABitsPerSample : TRVBitsPerSample;
      var AChannels : Integer); override;
Values of almost all parameters must be taken from TRVMicrophone.OnGetAudio event. It's not enough to send an audio stream from AStream, you need to send other parameters as well, receive them, and pass to TRVAudioPlayer.PlayAudio.
The only additional parameter is AGUID, fill it yourself, it must identify the audio source (the same value of GUID must be for all audio data from the same source, different sources must have different AGUID)
WpgnGaming
Posts: 20
Joined: Mon Dec 21, 2015 7:54 pm

Re: [Help] with Overbyte with RVMedia and streaming microphone data to all connected clients.

Post by WpgnGaming »

thanks, yea I slowly working this out but on a other note because your

Code: Select all

procedure PlayAudio(AStream : TMemoryStream;
      var ADataSize : Integer; AGUID : TGUID; const AAudioIndex : Word;
      var AStartTime, ADuration : Longword;
      var ASamplesPerSec : TRVSamplesPerSec;
      var ABitsPerSample : TRVBitsPerSample;
      var AChannels : Integer); override;
uses var in the procedure itself, am unable to access it outside of the vcl it self, as it calls following error
[DCC Error] Test_unit.pas(139): E2033 Types of actual and formal var parameters must be identical
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: [Help] with Overbyte with RVMedia and streaming microphone data to all connected clients.

Post by Sergey Tkachenko »

This error occurs because you use wrong types for some parameters. The types of var-parameters must be exactly the same as declared.
Post Reply