Author Topic: MediaPlayer  (Read 298 times)

Muetze

  • Posts: 6
MediaPlayer
« on: 13 Jan '18 - 10:37 »
Hello @ all,

when iam play a video (mp4) in my MediaPlayer, so the bass is not runing in the Progress Bars. By mp3 all its okay.
What can i do that the Progressbar its runing.

Here is my code under VB.

Code: [Select]
Imports Un4seen.Bass
Imports CoreAudioApi
Imports Un4seen.Bass.AddOn.Tags
Imports System.Security.Policy
Imports AxAXVLC

Public Class Form1
    Public stream As Integer
    Public peak(2) As Single
    Private _StartTime As Long
    Dim Svol As Integer = 0
    Private Function SetVol() As Integer
        Dim DevEnum As New MMDeviceEnumerator
        Dim device As MMDevice = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia)
        device.AudioEndpointVolume.MasterVolumeLevelScalar = Svol / 100.0F
        Return Svol
    End Function
    Private Function GetVol() As Integer
        Dim MasterMin As Integer = 0
        Dim DevEnum As New MMDeviceEnumerator
        Dim device As MMDevice = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia)
        Dim Vol As Integer = 0
        With device.AudioEndpointVolume
            Vol = CInt(.MasterVolumeLevelScalar * 100)
            If Vol < MasterMin Then
                Vol = CInt(MasterMin / 100)
            End If
        End With
        Return Vol
    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AxWindowsMediaPlayer1.Visible = True
        Timer2.Stop()
        BassNet.Registration("f.muetze@wentorfer-pflegeteam.de", "2X16382332322323")
        If (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Me.Handle)) = False Then
            MessageBox.Show("Fehler beim Laden der Library")
        End If
        Label3.Text = Format$(Now, "long date")
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
 
        Bass.BASS_ChannelGetLevel(stream, peak)
        Dim rechts As Integer = (Math.Round(peak(1), 3) * 100)
        Dim links As Integer = (Math.Round(peak(2), 3) * 100)
        Try
            ProgressBar1.Value = rechts
            ProgressBar2.Value = links
        Catch
        End Try
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Bass.BASS_ChannelPlay(stream, False)
            Timer1.Start()
            Timer2.Start()
            _StartTime = Date.Now.Ticks

        'AxWindowsMediaPlayer1.Visible = True
        'AxWindowsMediaPlayer1.URL = TextBox1.Text
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            stream = Bass.BASS_StreamCreateFile(OpenFileDialog1.FileName, 0, 0, BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_STREAM_PRESCAN)
            TextBox1.Text = OpenFileDialog1.FileName
            Timer1.Start()
            Label1.Text = "00:00"
        End If
    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        Dim span = TimeSpan.FromTicks(Date.Now.Ticks - _StartTime)
        Label1.Text = String.Format("{0:mm}:{0:ss}", span)
    End Sub

    Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
        Svol = TrackBar1.Value
        If Svol < 0 Then
            Svol = 0
        ElseIf Svol > 100 Then
            Svol = 100
        End If
        Label2.Text = GetVol() & "%"
        SetVol()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        'AxWindowsMediaPlayer1.Ctlcontrols.stop()
        Bass.BASS_ChannelStop(stream)
        Timer2.Stop()
        Label1.Text = "00:00"
        TextBox1.Text = ""
        AxWindowsMediaPlayer1.Focus()
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        'AxWindowsMediaPlayer1.Ctlcontrols.pause()
        Bass.BASS_ChannelPause(stream)
        Timer2.Stop()
        Button4.Visible = False
        Button5.Visible = True
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        'AxWindowsMediaPlayer1.Ctlcontrols.play()
        Bass.BASS_ChannelPlay(stream, False)
        Timer2.Start()
        Button4.Visible = True
        Button5.Visible = False
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        Application.Exit()
    End Sub

    Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
        Label4.Text = CStr(TimeOfDay)
    End Sub
End Class

May somebody can help me - Google have nothing....

Guest

  • Guest
Re: MediaPlayer
« Reply #1 on: 13 Jan '18 - 13:45 »
Without any addon as BassVideo or semilar bass do nothing with *.mp4 Video i think

Muetze

  • Posts: 6
Re: MediaPlayer
« Reply #2 on: 15 Jan '18 - 08:18 »
Hello @ all

Wich addon i needed for playing videos over Mediaplayer or VLC Payer.
And - may somebody has a code for Radio Stream, i found some in Google, maybe i need also a addon.

Best wishes

Friedhelm Mütze