Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, November 3, 2008 11:40:30 PM(UTC)

kolli  
kolli

Groups: Registered
Posts: 2


Hello, I've downloaded the SDK yesterday after a long search of how to "stream a video from memory". I have to say I'm no professional developer in .NET or something. I just want to try out something =) So what I actually want to know is, if it's possible to actually stream a video from a memory stream with this SDK. What I want to do is this:

1. Video file get's opened client-side and readed into a byte array.
2. Bytes will be encrypted and send to a remote-client over UDP (custom protocol, I don't want to use the LEADTOOLS streaming functionality).
3. The remote client decrypts each packet and add them to a memory stream.
4. The remote client should now be able to play the already arrived packets (the open memory stream) and backward-seeking (to the already loaded packets) should be possible.

I played around with the AxltmmPlayCtrl and was able to load a video from a byte-array. When I then try to play the video (first frame is already visible), VB .NET crashes :( But however, I think maybe the "SourceObject"-method is what I'm looking for?! Unfortunately my knowledge is not good enough to get this working.

Can anyone give me informations/help/thoughts about this?

Thanks,
kolli
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, November 5, 2008 5:43:00 AM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 367

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

Hello,

Yes, Leadtools can play from a memory stream, and it should be possible to accomplish what you're looking to do. However, Leadtools does not provide any type of encryption methods in our SDK.

You'll want to set the SourceType to ltmmPlay_Source_HGlobal, and set the SourceHGlobal property on the player control to indicate where the memory is to play from.

Here is a code sample which will help illustrate how to play a file in memory:

Dim openFileDialog1 As New OpenFileDialog
Dim fn As String
Dim mmBinFileStream As System.IO.FileStream

'Present the user with a file open dialog box.
openFileDialog1.Filter = "BMP (*.bmp)|*.bmp|MPG (*.mpg)|*.mpg|Windows Media Audio (*.wma)|*.wma|Windows
Media Video (*.wmv)|*.wmv"
openFileDialog1.RestoreDirectory = True

If openFileDialog1.ShowDialog() = DialogResult.OK Then
fn = openFileDialog1.FileName
lblTitle.Text = "Title: " + fn.Substring(fn.LastIndexOf("\") + 1)
'***********************************************************
'For sourcefile method (works for any file format)
'ltmmPlayer.sourcefile = openFileDialog1.FileName
'***********************************************************
'For byte-array method (works for MPGs,WMAs,WMVs,AVIs, but not for BMPs!!!)
mmBinFileStream = New FileStream(fn, FileMode.Open)
ReDim mmBytes(mmBinFileStream.Length)
mmBinFileStream.Read(mmBytes, 0, mmBinFileStream.Length)
mmBinFileStream.Close()
mmPtr = Marshal.AllocHGlobal(mmBytes.Length())
Marshal.Copy(mmBytes, 0, mmPtr, mmBytes.Length())
ltmmPlayer.ResetSource()
ltmmPlayer.SourceHGlobal = mmPtr.ToInt32()
'ltmmPlayer.sourcefile = fn
'***********************************************************
End If
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#3 Posted : Wednesday, November 5, 2008 1:28:04 PM(UTC)

kolli  
kolli

Groups: Registered
Posts: 2


Hello walter, thank you for your response. I've tried the code you
provided and it works well. Only problem I have now is how to add additional bytes to the memorystream after I created it with:

mmPtr = Marshal.AllocHGlobal(mmBytes.Length())
Marshal.Copy(mmBytes, 0, mmPtr, mmBytes.Length())


Maybe my explaination in the first post was not good enough. Basicly I
want to be able to play the video when it's not even *fully* loaded
into the memory. So for example I have a video of 2mb size. I load 1mb
into the memory and start playing it. Then, some seconds later, I add
the remaining bytes to the memory and the player should just go on and
play it. Is that possible? I hope you understand what I mean. Basicly I
want to create a streaming-player like for example the Flash-Player you
see on YouTube. Also I would do the noted encryption by myself then. If it's possible, please provide me with some hints of how to do it.

Thanks,
kolli
 
#4 Posted : Friday, November 7, 2008 8:20:10 AM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 367

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

You'll need to create a custom filter to do this. The filter should buffer the samples and then send them out as it can.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.199 seconds.