Windows Phone 7: Seeking in MediaElement - c#

I'm working with a MediaElement for Windows Phone 7, and I want to make a simple slider that will allow a user to seek within an mp3 file. I can't quite get the behavior I want though. When I seek a short distance forward, it will work fine. But if I try to seek to the far end of the media, it will no longer play and go silent. Is there some sort of buffering that is occuring under the hood that is preventing seeking long distances? Has anyone overcome this issue or found a solution?
I've been referencing this post on msdn for info, but my URI is coming straight from media included in the xap file, not being transferred over a network protocol. I am also using the MediaElement.Position property to seek.

Have you tested that the media will play to those "far points" if you just let it play normally and don't try and skip ahead to them? If this fails too it could indicate a corrupt file.
How are you requesting the change relative to multiple changes to the slider? If you're making lots of changes to the position in quick succession this may be the problem. Are you checking CanSeek each time before you change the position? Does your slider allow for a single event to trigger a big "jump" or does it try and do lots of little ones?
It may also be worth copying the file to IsolatedStorage and trying to play it from there. I have vague recollections of this helping with something similar once before.

Related

Taking pictures and recording multimedia files from WPF-application

we are in need of a way to record videos with sound and taking pictures inside a WPF-application. It should be able to save locally to disk. Preferably it should be able to show the content once it is saved as well, but if no such component exists, we will use another component for the playback.
I've looked around and found no real good options to do this. Some options lack the sound recording in videos, and some are just too old to get working properly (WPF has had a long run so far...)
Does anyone here has any experience in this specific area?
Got Taking Pictures and Videos working with this little documentation https://www.codeproject.com/Articles/330177/Yet-another-Web-Camera-control
If you dont tell us what problems exactly you got, or which code you already got, we can't really help.

Easiest way to play audio in an openTK application, using any method

My goal here is to be able to play an MP3 in an OpenTK/OpenGL application (.NET but NOT windows forms), being able to stop/play/pause it, access/set the position of the audio file, and have it play to within a few milliseconds of when I tell it to.
I've tried using WindowsMediaPlayer (WMPLib) but for whatever reason the audio doesn't start playing until I resize or move the window. Not sure why but it probably has something to do with the fact that it's meant to be a control on Windows Forms, and this is a GL application.
I've tried using .NET's soundplayer but that incurs a huge delay of up to a second, and I can't set/access the position of the file.
I've looked into OpenTK and OpenAL but that seems way too complex to figure out.
Does anyone have any ideas?
THANKS!
Oh and worst case scenario I could also deal with playing WAV or OGG files instead, and if the play timing is accurate enough I wouldn't need access to the position of the audio.
OpenAL may seem complicated, but it sounds like the best solution to your problem. There's plenty out there on it, though most examples might be in other languages, but the API is the same. Perhaps this thread has some solutions as well.

Is it possible to get precise timestamps for frames in video file from VLC?

I’m looking to use VLC as the foundation for a video player within my application written in C# (since VLC is one of the few players that can properly decode the format I’m working with), but the primary tasks that I need it to perform are:
Ability to browse between separate frames in a video file, both
forward and back.
Displaying a precise timestamp for each frame down to the
millisecond, and the ability to relay the timestamp to an
application.
Right now I’m doing this by means of a VLC extension LUA script, but the time VLC returns via vlc.var.get(input, “time”) lacks precision and can differ for the same frame in the same video file across multiple file readings. The frame browsing doesn’t work too reliably either. Plus, the values received in this way cannot be automatically relayed to another application.
I tried using the LibVLC.NET wrapper for libVLC, but I still couldn’t browse between frames, and the millisecond count values returned were rather odd. It’s almost like VLC (libVLC) doesn’t return an actual time value during playback but rather some sort of rounded value, a value with substantial delay when reading with precision down to the millisecond. The standard VLC interface can neither display precise time values down to the millisecond, nor browse between frames.
Is there any viable way to perform the two aforementioned tasks with VLC by somehow running VLC from an application written with the use of .NET? Or should I look into other options?
I am not sure that you can do that with VLC. But you can use this example which uses very good framework called ffmpeg
I am almost sure that you will be able to play your stream and navigate through. In addition there is another solution that you may use , I have to say that i am not familiar with it but it worth checking.
Basically try to find .Net implementation of video player instead of working VLC

Reading specific frames from video file with .NET (not necessarily in sequential order)

I have a .NET Winform application and i need to show specific frames of a video file. Frames aren't necessarily in sequential order and are loaded when the user moves a slider, or when the application fires some events. I tried the following things:
Using EmguCV (OpenCV Wrapper): The problem here is that when i use SetCaptureProperty (With CAP_PROP.CV_CAP_PROP_POS_FRAMES, AVI_RATIO or MSEC ) to sets capture's position, the position isn't seted correctly (I checked it using GetCaptureProperty next to the SetCaptureProperty instruction). So, the frame returned by QueryFrame isn't the needed frame.
Using WPF MediaElement with Clock driven behavior: I can set the position of the video at the place that i need. The problem is that i don't know how get only one frame of the video sequence. By default, i have the Clock controller paused. When I set the position, If I call Clock.Controller.Resume(), then the video start playing from here. If I don't call Clock.Controller.Resume(), or if i call Clock.Controller.Resume() and then Clock.Controller.Pause() nothing is happening.
Im looking for another video library that can be used for accomplish this work, but i am not sure about what could be used. Any idea?
Thanks a lot for all comunity members, not only for help with this answer, but for the very big help that you give me with my problems every day. Iam new, but i would try to return these helping others with your problems.
Sorry for my terrible english! (Im spanish speaker and english speaking is not my best quality :S)

DirectShow DVD manipulation and capturing

I am new to DirectShow.
My intention was to develope a small application (C#) that handles video processing.
The main tasks i need are :
1 - Display video content from a DVD.
2 - Navigate to specific points of time in the video.
3 - Capture specific frames into still images and save them to files.
Sounded easy at first, but after reading thousands of blogs, forums and code samples i can't figure out how this can be done .
I am pretty sure these tasks have been implemented plenty of times, so if anyone has anything that can help i would be very happy to hear it.
As i am getting desperate on this issue, buying external DLLs or paying for some advice is an option.
Thanks.
Not sure if this will help, but I have a DvdPlayerElement control in my WPF MediaKit.
You must install an audio codec if you want audio as the built in one with Windows is locked down due to licensing.
perhaps you can wrap the MSVidWebDVD object, combined with some screen capture techniques [?] see also Extract frame from VOB(DVD) file
Thanks Jeremiah, I do know WPF MediaKit and tried working with it.
It is pretty cool, but does not allow all of the functionality available in DirectShow.
There are some events missing and the seeking operation does not seem to work for me.
I guess i can dig in the code and figure it out, but the time pressure won't allow it.
If you have an example of an application that accomplishes what i am looking for (display, seek, capture) i would be very happy to take a look.
Thanks again.

Categories