IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

AxWindowsMediaPlayer problème de fichier bloqué


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Homme Profil pro
    Analyse système
    Inscrit en
    Novembre 2016
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Analyse système

    Informations forums :
    Inscription : Novembre 2016
    Messages : 3
    Par défaut AxWindowsMediaPlayer problème de fichier bloqué
    Quand j'utilise le AxWindowsMediaPlayer et un un composant taglib (pour les tag mp3) j'ai un message IOException
    alors que je ferme bien le mediaplayer avec ceci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
            MP_ID3Tag.Ctlcontrols.stop()
            MP_ID3Tag.URL = ""
            MP_ID3Tag.currentPlaylist.clear()
            MP_ID3Tag.close()

    Quelqu'un à déjà eu un problème similaire ? J'ai parcouru mon code pour essayer de trouver un endroit ou je le ferme pas mais impossible.

    Merci pour votre aide


    Détail du message:
    System.IO.IOException was unhandled
    HResult=-2147024864
    Message=The process cannot access the file 'C:\Users\Desktop\mp3\test2.mp3' because it is being used by another process.
    Source=mscorlib
    StackTrace:
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
    at System.IO.File.Open(String path, FileMode mode, FileAccess access)
    at TagLib.File.LocalFileAbstraction.get_WriteStream()
    at TagLib.File.set_Mode(AccessMode value)
    at TagLib.NonContainer.File.Save()
    at WindowsApplication1.module_perso.ID3Write(String filename, String _Title, String _Artiste, String _Album, String _Commentaires) in C:\Users\documents\visual studio 2010\Projects\impro\impro\module_perso.vb:line 70
    at WindowsApplication1.EditID3tag.Bt_save_Click(Object sender, EventArgs e) in C:\Users\id980181\documents\visual studio 2010\Projects\impro\impro\EditID3tag.vb:line 19
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    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(IntPtr 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 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    InnerException:

  2. #2
    Membre Expert
    Avatar de wallace1
    Homme Profil pro
    Administrateur systèmes
    Inscrit en
    Octobre 2008
    Messages
    1 966
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : Administrateur systèmes
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Octobre 2008
    Messages : 1 966
    Billets dans le blog
    7
    Par défaut
    bonsoir,

    Tout est marqué dans ton exception..... le numero des lignes qui posent probème. Tu devrais pouvoir te debrouiller avec ca !
    Bref...a quel moment fermes-tu ton player ? Avant ou apres l edition des id3 tags ?

    @+

  3. #3
    Candidat au Club
    Homme Profil pro
    Analyse système
    Inscrit en
    Novembre 2016
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Analyse système

    Informations forums :
    Inscription : Novembre 2016
    Messages : 3
    Par défaut
    Avant

    Y a t il une possibilité de voir par quoi le fichier est déjà bloqué ?

    Ici j'ai le même problème sur un boutton qui copie le fichier en tmp et le joue, ça marche une fois ensuite tu re clique sur le même bouton le fichier est toujours en mémoire dans le mediaplayer et le debugger donne l erreur IOException sur la copie de tmp.mp3

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Dim Filetmp As String = GlobalVariable.PathTMP & "\tmp.mp3"
    MP_ID3Tag.URL = vbNull
    MP_ID3Tag.close()
    My.Computer.FileSystem.CopyFile(TB_Source.Text, Filetmp, True)
    MP_ID3Tag.Ctlcontrols.currentPosition = PlayWithDelay(TB_Source.Text)
    MP_ID3Tag.URL = Filetmp[/LEFT]

  4. #4
    Candidat au Club
    Homme Profil pro
    Analyse système
    Inscrit en
    Novembre 2016
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Analyse système

    Informations forums :
    Inscription : Novembre 2016
    Messages : 3
    Par défaut workaround
    J'ai trouvé une solution alternative, la cause axwindowsmediaplayer qui est lent/capricieux ou un bug

    Mais c'est pas l idéal si quelqu'un à un avis !

    J'ai du bouclé sur l'ouverture du fichier avec un try, il y a quand même un décalage de 3 secondes et c est vraiment pas beau


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    Dim Filetmp As String = GlobalVariable.PathTMP & "\tmp.mp3"
            Dim lockfile As Boolean = True
            MP_ID3Tag.URL = ""
            MP_ID3Tag.close()
     
            While (lockfile = True)
                Try
                    My.Computer.FileSystem.CopyFile(TB_Source.Text, Filetmp, True)
                    lockfile = False
                Catch ex As Exception
                    Thread.Sleep(100)
                End Try
            End While
     
                MP_ID3Tag.Ctlcontrols.currentPosition = PlayWithDelay(TB_Source.Text)
                MP_ID3Tag.URL = Filetmp

    Une autre idée ?

    Merci

Discussions similaires

  1. Problème avec fichier hosts: bloqué
    Par Yuston dans le forum Windows XP
    Réponses: 2
    Dernier message: 04/05/2008, 17h27
  2. [Servlet] Probléme écriture fichier
    Par hedgehog dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 23/05/2005, 15h17
  3. Problème lecture fichier en C++
    Par cali1983 dans le forum C++
    Réponses: 17
    Dernier message: 20/05/2005, 09h36
  4. Problème ouverture fichier par double clic...
    Par sankookai dans le forum MFC
    Réponses: 4
    Dernier message: 11/05/2005, 09h13
  5. Problème avec fichier texte
    Par jpdelx dans le forum ASP
    Réponses: 7
    Dernier message: 13/11/2003, 13h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo