Android Question mute audio in videoview

jazzzzzzz

Active Member
Licensed User
Longtime User
I am receiving 4 rtsp video links simultaneously in a single screen using videoview in the audio library... I want to mute individual videos when clicking on a button... But videoview doesnot have an option to mute audio...i want to play audio of single stream at a time and mute others... How can i do that?
 

jazzzzzzz

Active Member
Licensed User
Longtime User
This code does the same as the code I posted above.
can you check the volume control yourself...just play a video from sdcard...Am actually play 4 rtsp video streams simultaneosly...An wanna control volume of individual channel
 
Upvote 0

jazzzzzzz

Active Member
Licensed User
Longtime User
no its not changing changing volume...i will post my example code...you try..
B4X:
#Region  Project Attributes
    #ApplicationLabel: aud
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.


End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
   
    Dim v,v1 As VideoView
    Dim b1,b2 As Button
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
   
    v.Initialize("V")

    v1.initialize("v1")
    b1.Initialize("b1")
    b2.Initialize("b2")
    b1.Text = "up"
    b2.Text = "down"
    Activity.AddView(v,0,0,50%x,50%y)
    Activity.AddView(v1,50%x,0,50%x,50%y)
    Activity.AddView(b1,0,0,10%x,10%y)
    Activity.AddView(b2,0,25%y,10%x,10%y)
    v.LoadVideo("http","rtsp://192.168.1.81:5544/DLINK")
    v1.LoadVideo("http","rtsp://192.168.1.81:5544/CAM1")
    'v.LoadVideo(File.DirRootExternal,"a.mp4")
    v.Play
    v1.Play
End Sub

Sub b1_click

Volume3(v,0)

End Sub

Sub b2_click

Volume3(v,100)

End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Volume3(vv As VideoView,k As Int )
   
    Dim r1, r2 As Reflector
    r1.Target = vv
    r1.Target = r1.GetField("mMediaPlayer")
   
    If r1.Target = Null Then
   
        CallSubDelayed2(Me, "Volume3", vv)
        Return
       
    End If
   
    Dim mp As MediaPlayer
    r2.Target = mp
    r2.SetField2("mp", r1.Target)
    mp.SetVolume(k,k)
   
End Sub
 
Upvote 0

jazzzzzzz

Active Member
Licensed User
Longtime User
Or please gave a working code that you tested with a seekbar controlling volume of 2 videoview....If you are free..
 
Upvote 0

jazzzzzzz

Active Member
Licensed User
Longtime User
at that time i just need mute...Now also mute is working...but when a put volume back to 100% it will not come.,...at that time i haven't checked that
 
Upvote 0

jazzzzzzz

Active Member
Licensed User
Longtime User
am attaching an example,it just play two videos...one is from sdcard other is an rtsp link....both videos are playing well....

when i press mute both videos will be muted...but when i press unmute nothing happens...that is my problem...
 

Attachments

  • test.zip
    364 KB · Views: 246
Upvote 0

jazzzzzzz

Active Member
Licensed User
Longtime User
OK...I don't know that...now muting and unmuting works

Is there any way to use seekbar to control audio(not mute and unmute)?? without changing system music volume
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…