من این کد دارم وقتی فیلم اجرا میکنه 10 ثانیه 10 ثانیه پرش داره
وقتی فیلم اجرا میشه از 0 ثانیه پرش میکنه به 10 ثانیه بعد پرش میکنه به 20 ثانیه و.... همینطور تا اخر مشکل چیه؟
#Region Project Attributes
#ApplicationLabel: B4A Example
#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.
Dim timer1,timer2 As Timer
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 vv As VideoView
Dim mediaplayer1 As MediaPlayer
Private Button2 As Button
Private Button1 As Button
Private SeekBar1 As SeekBar
Private Label1 As Label
Private SeekBar2 As SeekBar
Private Button3 As Button
Private SeekBar3 As SeekBar
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("persianCG")
File.Copy(File.DirAssets,"ha.mp4",File.DirInternal,"ha.mp4")
vv.Initialize("vv")
End Sub
Sub timer1_Tick
If mediaplayer1.IsPlaying Then
SeekBar1.Max = mediaplayer1.Duration
SeekBar1.Value = mediaplayer1.Position
Dim a As Int =(mediaplayer1.Position/1000)
Dim s As Int = a Mod 60
Dim m As Int = a/60
Label1.Text = m & ":" & s
End If
End Sub
Sub timer2_Tick
If vv.IsPlaying Then
SeekBar3.Max = vv.Duration
SeekBar3.Value = vv.Position
Dim y As Int =(vv.Position/1000)
Dim u As Int = y Mod 60
Dim k As Int = y/60
Label1.Text = k & ":" & u
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
mediaplayer1.Initialize()
mediaplayer1.Load(File.DirAssets,"faseleh.mp3")
timer1.Initialize("timer1", 1000)
timer1.Enabled=True
mediaplayer1.Play
End Sub
Sub Button2_Click
mediaplayer1.Pause
End Sub
Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
mediaplayer1.Position = SeekBar1.Value
mediaplayer1.Play
End Sub
Sub SeekBar3_ValueChanged (Value As Int, UserChanged As Boolean)
vv.Position = SeekBar3.Value
vv.Play
End Sub
Sub SeekBar2_ValueChanged (Value As Int, UserChanged As Boolean)
mediaplayer1.SetVolume(Value/100 , Value/100)
End Sub
Sub Button3_Click
Activity.AddView(vv, 0, 0, 100%x, 80%y)
vv.LoadVideo(File.DirInternal,"ha.mp4")
vv.Play
vv.MediaControllerEnabled=False
End Sub
Sub vv_Complete
Log("Playing completed")
End Sub
سوال
sinamohammadi 10
سلام دوستان
من این کد دارم وقتی فیلم اجرا میکنه 10 ثانیه 10 ثانیه پرش داره
وقتی فیلم اجرا میشه از 0 ثانیه پرش میکنه به 10 ثانیه بعد پرش میکنه به 20 ثانیه و.... همینطور تا اخر مشکل چیه؟
#Region Project Attributes #ApplicationLabel: B4A Example #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. Dim timer1,timer2 As Timer 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 vv As VideoView Dim mediaplayer1 As MediaPlayer Private Button2 As Button Private Button1 As Button Private SeekBar1 As SeekBar Private Label1 As Label Private SeekBar2 As SeekBar Private Button3 As Button Private SeekBar3 As SeekBar 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("persianCG") File.Copy(File.DirAssets,"ha.mp4",File.DirInternal,"ha.mp4") vv.Initialize("vv") End Sub Sub timer1_Tick If mediaplayer1.IsPlaying Then SeekBar1.Max = mediaplayer1.Duration SeekBar1.Value = mediaplayer1.Position Dim a As Int =(mediaplayer1.Position/1000) Dim s As Int = a Mod 60 Dim m As Int = a/60 Label1.Text = m & ":" & s End If End Sub Sub timer2_Tick If vv.IsPlaying Then SeekBar3.Max = vv.Duration SeekBar3.Value = vv.Position Dim y As Int =(vv.Position/1000) Dim u As Int = y Mod 60 Dim k As Int = y/60 Label1.Text = k & ":" & u End If End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub Button1_Click mediaplayer1.Initialize() mediaplayer1.Load(File.DirAssets,"faseleh.mp3") timer1.Initialize("timer1", 1000) timer1.Enabled=True mediaplayer1.Play End Sub Sub Button2_Click mediaplayer1.Pause End Sub Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean) mediaplayer1.Position = SeekBar1.Value mediaplayer1.Play End Sub Sub SeekBar3_ValueChanged (Value As Int, UserChanged As Boolean) vv.Position = SeekBar3.Value vv.Play End Sub Sub SeekBar2_ValueChanged (Value As Int, UserChanged As Boolean) mediaplayer1.SetVolume(Value/100 , Value/100) End Sub Sub Button3_Click Activity.AddView(vv, 0, 0, 100%x, 80%y) vv.LoadVideo(File.DirInternal,"ha.mp4") vv.Play vv.MediaControllerEnabled=False End Sub Sub vv_Complete Log("Playing completed") End Subلینک ارسال
به اشتراک گذاری در سایت های دیگر
1 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.