B4A Library [Lib] VideoView Mute And UnMute Audio(VideoView In Audio Lib)

Note: This Lib Need Reflection Library
Hi guys,
there is a VideoView in the audio library that does not have a mute mode. I tried to fix it. I hope it is useful.


How To Use:


Example:
    Dim vv As VideoView
    vv.Initialize("vv")
    Activity.AddView(vv, 10dip, 10dip, 250dip, 250dip)
    vv.LoadVideo(File.DirRootExternal, "somefile.mp4")
    vv.Play
    
    Dim KVM As KDB_VV_Mute
    KVM.MuteVideo(VV)   '   Or KVM.UnMuteVideo(VV)
 

Attachments

  • KDB_VV_Mute.b4xlib
    813 bytes · Views: 112

Theera

Expert
Licensed User
Longtime User
I 've tried to test app,but I've error message. How to solve it?
Index was out of range. Must be non-negative and less than the size of the collection.<br />Parameter name: index
Sub class_globals is missing.
B4X:
Sub Class_Globals
    'ตัวแปรที่ประกาศที่นี่จะสามารถเข้าถึงได้จากทุก Module
    
    Private Root As B4XView
    Private xui As XUI
    
    'หมายเหตุ  หากว่าคุณต้องการประกาศ ตัวจับเวลา(Timer) ควรต้องประกาศไว้ โมดูล Process_Globals มิเช่่นนั้น ตัวจับเวลา(Timer) จะถูกสร้างขึ้นใหม่ ทุกครั้ง
    'Private Timer1 As Timer
    
'    #if B4J
'       Private FX As JFX
'    #End If
End Sub

Public Sub Initialize
    B4XPages.GetManager.LogEvents = True
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    'เพิ่มโค้ดของคุณที่จะทำงานเมื่อสร้าง B4XPage
  
    Root = Root1
    Root.LoadLayout("MainPage")
    B4XPages.SetTitle(Me, "ปิด-เปิดเสียงวิดีโอ Mute/UnMute")  'ตั้งชื่อ ไตเติ้ล
  
    'กรณีมีการสร้างTimer เพื่อใช้งาน
    'Timer1.Initialize("Timer1",1000)
    'Timer1.Enabled=True  'ต้องตั้งค่า ให้ทำงานทุกครั้งที่เรียกใช้งาน
  
  
'    #If B4J
'       B4XPages.GetNativeParent(Me).Icon = xui.LoadBitmap(xui.DefaultFolder, "YourIcon.png")  'เพิ่ม ไฟล์ รูปภาพ ใน B4J\Files โดยเพิ่มที่ File Tab
'    #End If
    Dim vv As VideoView  'it's in Audio library
    vv.Initialize("vv")
    'Activity.AddView(vv, 10dip, 10dip, 250dip, 250dip)
    vv=xui.CreatePanel("")
    vv.Color=xui.Color_Blue
    'การใช้ Root.Addview แทน Activity.AddView
    Root.AddView(vv, 10dip, 10dip, 250dip, 250dip)
  
    'เพิ่ม Button ลงใน Root
'    Dim btn As B4XView=xui.CreateButton("")   '<==== There is no CreateButton ,How to solve?
'    btn.Text="กดฉัน"
'    'เพิ่ม Button ลงใน Root
'    Root.AddView(btn,10dip,270dip,250dip,50dip)
'  
  
  
    vv.LoadVideo(File.DirDefaultExternal, "thaiflag.mp4")
    vv.Play
  
    Dim KVM As KDB_VV_Mute
    KVM.MuteVideo(vv)   '   Or KVM.UnMuteVideo(VV)
  
  
End Sub
 

AmirPYTHON

Member
Test New Ver Of Lib V1.0.1
You Should Intialize


New Feature:
-SetVolume(Volume Should Between 0 and 1)
 

Attachments

  • KDB_VV_Mute.b4xlib
    909 bytes · Views: 100

Theera

Expert
Licensed User
Longtime User
Today, I still not be at the Shop, so I will test it again Tomorrow.Thank you for your replies.
 
Top