Funkar det inte ens om du sätter ett positivt tal, tex 1.5? Hm... QuickTime funkar då bra att spela upp (egentligen spola) baklänges i deras egen spelare.Filmvisare - Problem med inställning av hastighet
Spånar på ett visningsprogram för en utförd inventering av ett järnvägsspår, ska kunna visa en film och lite statistik längs med sträckan...
För att visa filmen har jag sneglat på koden nedan som är hämtad här:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=50480&lngWId=1
Man ska kunna ändra hastighet på visningen av filmen men det är här jag får problem, följande felmedelande kommer upp:
Run-time error 445
Object doesn´t support this action
Varför? i koden står det att man ska kunna ändra hastighet... Min förhoppning är att kunna visa filmen med -1, dvs baklänges i normal hastighet.
(Filmen är en mpg och referens till 'ActiveMovie Control type library' är satt)
Option Explicit
Option Base 0
Option Compare Text
Private m_dblRate As Double 'Rate in Frames Per Second
Private m_bstrFileName As String 'Loaded Filename
Private m_dblRunLength As Double 'Duration in seconds
Private m_dblStartPosition As Double 'Start position in seconds
Public m_boolVideoRunning As Boolean 'Flag used to trigger clock
Private dblPosition As Double ' Current Play position
Private m_objBasicAudio As IBasicAudio 'Basic Audio Object
Private m_objBasicVideo As IBasicVideo 'Basic Video Object
Private m_objMediaEvent As IMediaEvent 'MediaEvent Object
Private m_objVideoWindow As IVideoWindow 'VideoWindow Object
Private m_objMediaControl As IMediaControl 'MediaControl Object
Private m_objMediaPosition As IMediaPosition 'MediaPosition Object
' ****************************************************
' **** Main Video Loading method
' **** Use this method to load video file
Sub RunVideoContent(ByVal path As String, Optional ByVal DontMaintainRatio As Boolean, Optional ByVal FullScreen As Boolean)
Dim nCount As Long
Dim sScale As Double
Dim topMod As Long
On Local Error GoTo 0 'ErrLine
' NOTE: to get the clip duration use - m_dblRunLength
' Initialize global variables based on the
' contents of the file:
' m_bstrFileName - name of file name selected by the user
' m_dblRunLength = length of the file; duration
' m_dblStartPosition - point at which to start playing clip
' m_objMediaControl, m_objMediaEvent, m_objMediaPosition,
' m_objBasicAudio, m_objVideoWindow - programmable objects
'clean up memory (in case a file was previously opened)
UnloadActiveMovieControl
' Setting file to object
m_bstrFileName = path
'Instantiate a filter graph for the requested
'file format.
Set m_objMediaControl = New FilgraphManager
Call m_objMediaControl.RenderFile(m_bstrFileName)
'Setup the IBasicAudio object (this
'is equivalent to calling QueryInterface()
'on IFilterGraphManager). Initialize the volume
'to the maximum value.
' Some filter graphs don't render audio
' In this sample, skip setting volume property
Set m_objBasicAudio = m_objMediaControl
m_objBasicAudio.Volume = -1000
m_objBasicAudio.Balance = 0
'Setup the IVideoWindow object. Remove the
'caption, border, dialog frame, and scrollbars
'from the default window. Position the window.
'Set the parent to the app's form.
Set m_objVideoWindow = m_objMediaControl
m_objVideoWindow.WindowStyle = CLng(&H6000000)
m_objVideoWindow.Left = 0
' Getting Scale Ratio
sScale = m_objVideoWindow.Height / m_objVideoWindow.Width
' Setting object width
m_objVideoWindow.Width = Video_ActiveMovie.Video.Width
If Not (DontMaintainRatio) Then
m_objVideoWindow.Height = Video_ActiveMovie.Video.Width * sScale
topMod = (Video_ActiveMovie.Video.Height - m_objVideoWindow.Height) / 2
Else
m_objVideoWindow.Height = Video_ActiveMovie.Video.Height
End If
m_objVideoWindow.Top = topMod
' Setting FullScreen Mode
m_objVideoWindow.FullScreenMode = FullScreen
'reset the video window owner - The surface the video is implemented upon
m_objVideoWindow.Owner = Video_ActiveMovie.Video.hwnd
'Setup the IMediaEvent object for the
'sample toolbar (run, pause, play).
Set m_objMediaEvent = m_objMediaControl
'Setup the IMediaPosition object so that we
'can display the duration of the selected
'video as well as the elapsed time.
Set m_objMediaPosition = m_objMediaControl
'set the playback rate given the desired optional
m_objMediaPosition.Rate = 1 ' Normal play rate ** HÄR KAN JAG INTE ÄNDRA, VARFÖR?? **
' NOTE: you can set values like 1.5 for 150% speed, pretty nice
' Use user-established playback rate
m_dblRate = m_objMediaPosition.Rate
' getting play length
m_dblRunLength = Round(m_objMediaPosition.Duration, 2)
' Reset start position to 0
m_dblStartPosition = 0
' Play the file
PlayActiveMovie
Exit Sub
ErrLine:
Err.Clear
Resume Next
End Sub
Sv: Filmvisare - Problem med inställning av hastighet
ThomasSv: Filmvisare - Problem med inställning av hastighet
Kan ändra hastighet om jag gör om filmen till en .avi men kan fortfarande inte spela upp den baklänges, finns det någon lösning på detta problem??
Samma sak med Windows mediaplayer om jag inte missat någon inställning?
Annat filformat?Sv:Filmvisare - Problem med inställning av hastighet
Thomas