Introduction:In this article, we will see how to read and write large video files in a Silverlight OOB Application. The interesting thing here is that one of my questions in the c-sharcorner site's forum became this article.Creating Silverlight OOB Application:As your VS 2010 is taking a rest in the Windows taskbar, just minimize the browser window and maximize the VS 2010. So you are ready to create Silverlight OOB application now. Just follow the screenshot below [No: #]. Just press OK to Create the Silverlight OOB application.Setting for OOB Silverlight Application:Use the settings for an OOB application as given here. Go to the Project Properties. From properties page, follow the screenshot [W1, W2 Arrows].In Window 2, it is necessary to enable the Require elevated trust when running outside the browser checkbox.Designing the Silverlight OOB Application:Design the Application as per the image given below. Otherwise use the Xaml code to produce the design above.<Grid x:Name="LayoutRoot" Background="White" Height="240" Width="600"> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical"> <Border CornerRadius="10" Background="Black" Margin="0,20,0,0" Height="auto" Width="600"> <TextBlock Margin="10" Name="textfileName" Foreground="FloralWhite" Width="auto" TextWrapping="Wrap" /> </Border> <Border Height="113" Width="400" Margin="0,20,0,0" Background="Black" CornerRadius="20"> <TextBlock Margin="15" Name="textFileInfo" Foreground="FloralWhite" /> </Border> </StackPanel> <StackPanel Orientation="Horizontal" Margin="10"> <Button Content="Read" Height="22" Margin="200,0,0,0" Name="btnRead" Width="75" Click="ReadFile" /> <Button Content="Write" Height="23" Margin="30,0,0,0" Name="btnWrite" Width="75" Click="WriteFile" /> </StackPanel> </StackPanel> </Grid>Reading & Writing Large files:The screenshot below shows the common way to read and write the files. What is WRONG in this code?You may ask what is wrong in this code. There is nothing wrong if the File SIZE is smaller. However, if the file SIZE is too big then this type of error will occur.For me up to 1289749531 bytes there is no OUT OF MEMORY error. However, when the byte size is increased by 1 then it throws an error like the one above.How to Read Large Files?For this, I found a solution by which you can read and write large video files above 1.5 GB. In th preceding code there is no buffer used at all. The Method CopyTo() is used here to write the large video files.Application in Action: Summary:In this article we had a look at CopyTo() method which is used to write the large video files.Thanks for spending your precious time here. Please provide your valuable feedbacks and comments, which motivate me to write a better article next time. Thanks.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: