Controllo FLV-Player

martedì 07 giugno 2011 - 19.42
Tag Elenco Tags  VB.NET  |  .NET 4.0  |  Visual Studio 2010

dbfabio Profilo | Newbie

Qualcuno sa da dove potrei scaricare un controllo flv-player per windows application (possibilmente free)?

Gho5t Profilo | Junior Member

puoi utilizzare il componente WebBrowser che ti permette di navigare in internet tramite la web form...
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx

oppure puoi provare a vedere questi due esempi:
http://blog.shareoffice.it/webmaster/archive/2006/07/01/6451.aspx

http://www.codeproject.com/KB/audio-video/flashexternalapi.aspx
Se un uomo non è disposto a correre qualche rischio per le sue idee, o le sue idee non valgono nulla o non vale nulla lui

dbfabio Profilo | Newbie

Grazie mille.
Non riesco a fare una cosa...
Volendo aggiungere il controllo nella toolbox, clicco su choose items ma non viene fuori nei com components "Shockwave Flash Object"
Come si fa ad installare AxShockwaveFlashObjects ??
Grazie ancora

Gho5t Profilo | Junior Member

Non credo che si possa aggiungere nella toolbox.
Prova a fare click con il tasto destro del mouse sopra il progetto, fare Aggiungi riferimento (Add Reference in inglese), ed andare nella cartella C:\WINDOWS\system32\Macromed\Flash\, li dovresti trovarci un file chiamato Flash9d.ocx (o simile, dovrebbe essere in base alla versione di Flash installata, io ho Flash10s.ocx, per esempio).
Se lo aggiungi al progetto dovrebbe funzionare; ora non posso provarlo perché non ho il Visual Studio sotto mano, però se non ti funziona dimmelo che provo a vedere meglio con il Visual Studio.
Se un uomo non è disposto a correre qualche rischio per le sue idee, o le sue idee non valgono nulla o non vale nulla lui

dbfabio Profilo | Newbie

Si. Tutto è andato come mi hai detto.
Però nella WinForm di esempio di cui ti riporto qui il codice:

Public Class Form1
Public WORK_DIRECTORY As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
AxShockwaveFlash1.BeginInit()
AxShockwaveFlash1.LoadMovie(0, WORK_DIRECTORY + "\player.swf")
AxShockwaveFlash1.Play()
End Sub
End Class

nel controllo flash poi non viene visualizzato niente, resta bianco.
Nemmeno la WinForm http://www.codeproject.com/KB/audio-video/flashexternalapi.aspx funziona.
Stesso problema controllo bianco per file swf.
Inoltre se provo a caricare un file flv mi da questo errore:

System.Runtime.InteropServices.COMException was unhandled
Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
Source=Interop.ShockwaveFlashObjects
ErrorCode=-2147467259
StackTrace:
at ShockwaveFlashObjects.IShockwaveFlash.CallFunction(String request)
at AxShockwaveFlashObjects.AxShockwaveFlash.CallFunction(String request)
at Vml.FLVPlayer.FLVPlayer.LoadVideo(String videoPath) in C:\Users\dbfabio7\Desktop\FlashExternalAPI_Backup\Backup\FLVPlayer.cs:line 175
at Vml.FLVPlayer.FLVPlayer.openVideo_Click(Object sender, EventArgs e) in C:\Users\dbfabio7\Desktop\FlashExternalAPI_Backup\Backup\FLVPlayer.cs:line 168
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Vml.FLVPlayer.StartUp.Main(String[] args) in C:\Users\dbfabio7\Desktop\FlashExternalAPI_Backup\Backup\Startup.cs:line 32
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Riesci a spiegarmi perché?
Grazie

dbfabio Profilo | Newbie

Queesto il risultato del mio esempio


445x413 19Kb

Gho5t Profilo | Junior Member

non saprei che dirti... dovrei provarlo...
potresti mandarmi il progetto (sempre se puoi) oppure il file swf per fare delle prove io?
Se un uomo non è disposto a correre qualche rischio per le sue idee, o le sue idee non valgono nulla o non vale nulla lui

dbfabio Profilo | Newbie

Ecco a te.
Sei gentilissimo.
Grazie.

dbfabio Profilo | Newbie

Grazie di tutto Gho5t.
Ho fatto un po di ricerca e ho scoperto che per visualizzare i file flv basta scrivere:
AxShockwaveFlash1.BeginInit()
Dim xxx = WORK_DIRECTORY + "\file.flv"
If Not File.Exists(WORK_DIRECTORY + "\flvplayer.swf") Then
File.Copy(Application.StartupPath + "\flvplayer.swf", WORK_DIRECTORY + "\flvplayer.swf")
End If
AxShockwaveFlash1.LoadMovie(0, WORK_DIRECTORY + "\flvplayer.swf")
AxShockwaveFlash1.FlashVars = "file=" + xxx
AxShockwaveFlash1.AllowFullScreen = True
AxShockwaveFlash1.Play()

Ti faccio una ulteriore domanda:
Come faccio a non far comparire nel controllo i seguenti comandi:

496x27 11Kb

Gho5t Profilo | Junior Member

Potresti passarmi anche i file .flv e .swf?
Così lo provo.
Se un uomo non è disposto a correre qualche rischio per le sue idee, o le sue idee non valgono nulla o non vale nulla lui

dbfabio Profilo | Newbie

Il file file.flv è uno qualsiasi ... questo l'ho scaricato da Youtube.
Te li allego entrambi.
Nel frattempo sto cercando altre soluzioni dal sito di vlc.
Per ora ho trovato una libreria libvlc per .net ... ma non so come installarla in visual studio e non trovo l'ocx.

Puoi scaricare da qui il file zippato dei 2:
https://rapidshare.com/files/4290964087/swf_flv.zip
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5