Comments (13)
Ok - figured out a work around - in VlcMediaPlayer.cs (in Core) simply wrap the methods in a new thread. It must be a thread deadlock. i.e.:
public void Play()
{
Thread thread = new Thread(delegate() { Manager.Play(myMediaPlayer); });
thread.Start();
}
i voided setmedia as well, didnt need the return.
public void SetMedia(VlcMedia media)
{
Thread thread = new Thread(delegate() { Manager.SetMediaToMediaPlayer(myMediaPlayer, media.MediaInstance); });
thread.Start();
}
...
hope this helps...
from vlc.dotnet.
+1, I need this functionality too
from vlc.dotnet.
+1, I really need this as well - any work around?
from vlc.dotnet.
Maybe same issue as in #81. EndReached event (temporary) unregister all events and "reset" the media player core instance.
from vlc.dotnet.
Deadlocks will appear if you call Vlc methods from vlc callbacks. You should call that from another thread, as jfgbaker suggested, or with ThreadPool.QueueUserWorkItem()
or Task.Run
.
Closing this as a solution has been provided, feel free to reopen if needed.
from vlc.dotnet.
Hi every body
I’m using the latest version and I’m not calling Vlc methods from vlc callbacks
But my application freezes when I want to set another media from my play list.
I should mention that my application should play stream not video file.
I also tried these :
vlcControl.Play(currStream);
And
new System.Threading.Thread(()=>
{
vlcControl.Play(currStream);
}).Start();
And
new System.Threading.Tasks.Task(() =>
{
vlcControl.Play(currStream);
}).Start();
And
System.Threading.ThreadPool.QueueUserWorkItem((a) =>
{
vlcControl.Play(currStream);
});
but still freeze.
from vlc.dotnet.
The deadlock you are experiencing does not seem to be related to this issue. You might have a deadlock elsewhere in your code. Can you create a minimal project to reproduce that and send that on github so that we can have a look?
from vlc.dotnet.
Yes as you said my issue was not related to this thread.
When I was creating a minimal project I realized that my problem was related to this part of code :
private void vlcControl_LengthChanged(object sender,
Vlc.DotNet.Core.VlcMediaPlayerLengthChangedEventArgs e)
{
Action act = new Action(() =>
{
label2.Text = TimeSpan.FromMilliseconds(vlcControl.Length).ToString("hh\\:mm\\:ss");
});
if (this.InvokeRequired)
this.Invoke(act);
else
act();
}
I was calling calling Vlc methods from vlc callback (sorry, my mistake).
I changed my code to this :
private void vlcControl_LengthChanged(object sender, Vlc.DotNet.Core.VlcMediaPlayerLengthChangedEventArgs e)
{
Action act = new Action(() =>
{
label2.Text = TimeSpan.FromMilliseconds(vlcControl.Length).ToString("hh\\:mm\\:ss");
});
new Task(() =>
{
if (this.InvokeRequired)
this.Invoke(act);
else
act();
}).Start();
}
And my problem is solved now.
Thanks alot and apologize my spam
from vlc.dotnet.
Any reason you don't use the Length from your e
parameter? that would save a call to libvlc
from vlc.dotnet.
Any reason you don't use the Length from your
e
parameter? that would save a call to libvlc
do you mean this ?
e.NewLength
I will try it.
Thanks for your suggestion.
why
e.NewLength
is float but
vlcControl.Length
is long ?
from vlc.dotnet.
You're right, I changed the type in Vlc.DotNet.Core.Interops, but didn't propagate the change to Vlc.DotNet.Forms
The event is wrong, everything should be typed as Long
from vlc.dotnet.
Can you make a PR for that?
from vlc.dotnet.
Can you make a PR for that?
Sure, I will do it with pleasure.
from vlc.dotnet.
Related Issues (20)
- scaletempo_pitch filter not working HOT 1
- how to split or cut a video? HOT 1
- "Direct Show Device Fails to Open" If it Contains a Failed Device in a List of Capture Devices HOT 14
- How to use LibVLCSharp make a Video Provider like VlcVideoSourceProvider.cs !! HOT 1
- How to install the Vlc.DotNet.Wpf.to a WPF .Net Framework using VB HOT 1
- two player play at the same time HOT 6
- VlcControl.Dispose never ends after trying to open Blu-ray disk without licensing or after ejecting the disc HOT 1
- (re-edit)Can vlc.dotnet play RTP over TCP(RFC 4751) H.264 video stream? HOT 6
- Can't set VlcLibDirectory HOT 10
- I want to develop UI in raspberry pi. Is there any way? HOT 13
- TakeSnapShot with stream parameter? HOT 1
- How to support Chinese directories? HOT 2
- My program was frozen during the setmedia operation HOT 2
- Playing some videos on any platform will get stuck HOT 6
- How can I to get frame data? HOT 1
- Is it possible to start player for fixed time. Assume I want to satrt my player for 5 minutes. HOT 2
- Visualization custom modification HOT 2
- how to change the audioDevice ?i can't let the code effective
- Hiding the console log window is not work HOT 1
- How do i simply play a video and get past the barrage of error messages. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vlc.dotnet.