Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello there! I'm making a Video player.. main window contains 2 MediaElements, one of them is full size ( which supposed to show videos in its real quality ), and the other is so small ( 60x60 ) which is supposed to show small preview of the same video and appears as a balloon at the seekbar...
My Problem is when I try to play an HD video, the app use a lot of CPU (+70%) because it is playing two fully HD videos at the same time.. so what I want is to play the small video at very low resolution so I could decrease CPU usage, OR to resize Video and keep in Memory. Thanks

This what I use for the small Video:
<Ellipse Height="80" Width="80" Name="elipsemedia" HorizontalAlignment="Left" VerticalAlignment="Top" Stroke="White" StrokeThickness="5" >
    <Ellipse.Fill>
        <VisualBrush TileMode="None">
            <VisualBrush.Visual>
                <MediaElement x:Name="MediaPreview" Source="Source.mp4" Volume="0" ScrubbingEnabled="True" Stretch="UniformToFill" LoadedBehavior="Pause" Width="80" />
            </VisualBrush.Visual>
        </VisualBrush>
    </Ellipse.Fill>
</Ellipse>
Posted
Updated 12-Mar-14 18:08pm
v2
Comments
Sergey Alexandrovich Kryukov 13-Mar-14 0:01am    
Who told you that if you play originally hi-res video in low resolution it would reduce the CPU usage?! What logic could lead you to such a weird conclusion?
—SA
Boudi AlSayed 13-Mar-14 0:04am    
if the video had been resized to 60x60... it will not be HD, so then the app run more smoothly..as I think. or if there is a way to resize the video and keep it in memory to play it with the small mediaelement would be good..
Sergey Alexandrovich Kryukov 13-Mar-14 0:07am    
Not HD... more smoothly? Why?! You can resample video off-line, but if you want to do it on the fly, but adding this resampling might take more resources than playing it... :-)
—SA
Boudi AlSayed 13-Mar-14 0:10am    
I really don't know how to explain... I just want to make a video player with a small preview while Mouse on the seekbar... like Youtube... if there is a better way to do that than having two MediaElements, would do the work.. Thanks
Sergey Alexandrovich Kryukov 13-Mar-14 0:18am    
As far as I can see, this is not Youtube does. Youtube shows static frame when you put a mouse over the slider...
How is that related to your desire to resample video? By the way, why do you have performance problem with media element? I never saw any problem, unless you use very weak computer or online stream with a bottleneck on the Internet, but you cannot remove this bottleneck.

Before putting forward weird and not motivated "requirements" it would be good to sort out the reasons of your problems. Right now, even the problem is not formulated. 70% of CPU? You are telling it as if it was something bad... :-)

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900