[Gambas-user] Play tracks with gb.Media (Gstreamer)

Claus Dietrich claus.dietrich at freenet.de
Mon Jan 15 19:12:29 CET 2024


Am 15.01.24 um 18:16 schrieb Claus Dietrich:
> Am 15.01.24 um 13:07 schrieb System64 Development:
>> Hi,
>>
>> I want to play 2 tracks at the same time wit the "MediaPipeline" class.
>>
>> Claus solve the problem for internet streams using a "MediaContainer" 
>> class but I cant do it for 2 local media files, such mp3, ogg, aac etc.
>>
>> Then I mod the sample (see attachment) from gambas-it.org/wiki [1] 
>> but doesn't  work.
>>
>> So I share this little project if you want to test it.
>>
>> Note: I wan to do more things in the near future, such manage the 
>> volume independently for each file or mute some of them, join all the 
>> tracks in one file.
>>
>> [1] 
>> https://www.gambas-it.org/wiki/index.php/Eseguire_due_o_pi%C3%B9_file_audio_contemporaneamente_mediante_la_Classe_%27%27MediaPipeline%27%27_del_componente_gb.media
>>
>> Thanks.
>>
>> Martin

And here another version - much shorter.

Private pl As MediaPipeline
Private cPlayParallel As MediaContainer
Private src1 As MediaControl
Private src2 As MediaControl

Public Sub Form_Open()

   pl = New MediaPipeline As "PipeEvents"
   cPlayParallel = New MediaContainer(pl)

   src1 = New MediaControl(cPlayParallel, "playbin")
   src1["uri"] = "file:///home/claus/Musik/Song1.mp3"

   src2 = New MediaControl(cPlayParallel, "playbin")
   src2["uri"] = "file:///home/claus/Musik/Song2.mp3"

   pl.play

End

Best regards

Claus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240115/0817c9bf/attachment.htm>


More information about the User mailing list