Flyleaf icon indicating copy to clipboard operation
Flyleaf copied to clipboard

Multiple VideoViews and Panel.ZIndex support

Open a44281071 opened this issue 2 years ago • 8 comments

It doesn't need dx11, and we need “Video layer and video layer overlay“. FFME will copy surface to WriteableBitmap. It takes up twice as much memory, and its processing takes up too much. If we show 9 videos, It's impossible run x86 app with FFME player. But flyleaf can't overlay video image surface.

a44281071 avatar Apr 28 '22 07:04 a44281071

It's not possible to use D3DImage with hardware acceleration. So for performance reasons this can't change.

Can you please describe your requirements further to see if I can include them in the current implementation?

You want to overlay a videoview over another videoview?

SuRGeoNix avatar Apr 28 '22 08:04 SuRGeoNix

Yes, like a digram canvas, We can add many children, Like "office/text/picture/dicom/video". We can change this children location/size/layer_index by mouse thumb. Like PS canvas., but more media type.

a44281071 avatar Apr 29 '22 01:04 a44281071

@a44281071 Please have a look to the new test/sample that I have included in the solution and let me know if that solves your requirement

SuRGeoNix avatar Apr 29 '22 10:04 SuRGeoNix

Please re-open this if you still can't implement your design requirements

SuRGeoNix avatar Apr 30 '22 07:04 SuRGeoNix

@SuRGeoNix Thanks for your demo. But it is nested layer. For example:

  • I have a panel named 'DiagramCanvas'.
  • A ListBox in view, A Files in ViewModel.
  • ListBox.ItemsPanel is 'DiagramCanvas'.
  • Files.Add("aaa.jpg") | Add("bbb.mp4") | Add("ccc.dcom") | Add("ddd.mp4") | Add("eee.mp4")
  • 5 items move and resize by user. Play/show all items!

The display view is below: QQ截图20220512170717

a44281071 avatar May 12 '22 09:05 a44281071

Please give a try to re-explain me the missing feature so I can add it. I was not able to understand you.

SuRGeoNix avatar May 12 '22 10:05 SuRGeoNix

A demo for mvvm diagram list to play multi-media files. https://github.com/a44281071/TestMvvmFilePlayer

a44281071 avatar May 13 '22 02:05 a44281071

Well I was able to integrate this with Flyleaf with one issue. You can't implement ZIndex on WindowsFormsHost as it will be always above other WPF elements as it is a separate HWND. This means you will need to replace the package / Screen that you currently use with a different approach. I will try to look deeper on this one later on.

I just used this one FileViewModel

public Player MediaPlayer { get; set; } = new Player();

I change MediaElement with this on FileView

<fl:VideoView x:Name="VideoView" Player="{Binding MediaPlayer}"/>

And opened the inputs with an event on FileView with this

private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            ((FileViewModel) DataContext).MediaPlayer.OpenAsync(((FileViewModel) DataContext).FilePath);
        }

I used AppBootstrapper constructor to Engine.Start() ...

SuRGeoNix avatar May 13 '22 08:05 SuRGeoNix

Have a look on the new videoview implementation and let me know if that covers your requirements.

Update: Just did a quick test by replacing your DiagramListBox with FlyleafHosts and works great ;)

...
xmlns:fl="clr-namespace:FlyleafLib.Controls.WPF;assembly=FlyleafLib"
...

<Border>
	<!--<t3:DiagramListBox Name="Items"
				 t3:SelectorAttached.SelectNoneWhenClickBlankArea="True"
				 Background="AliceBlue"
				 ItemContainerStyle="{StaticResource FileItemStyle}" Visibility="Collapsed" />-->

	<Grid >
		<fl:FlyleafHost Player="{Binding MediaPlayer1}" KeepRatioOnResize="True" VerticalAlignment="Top" HorizontalAlignment="Left" Width="180" Height="120" AttachedDragMove="Surface" AttachedResize="Surface" />
		<fl:FlyleafHost Player="{Binding MediaPlayer2}" KeepRatioOnResize="True" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="100" Width="180" Height="120" AttachedDragMove="Surface" AttachedResize="Surface" />
		<fl:FlyleafHost Player="{Binding MediaPlayer3}" KeepRatioOnResize="True" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="200" Width="180" Height="120" AttachedDragMove="Surface" AttachedResize="Surface" />
		<fl:FlyleafHost Player="{Binding MediaPlayer4}" IsAttached="True" DetachedTopMost="False" KeepRatioOnResize="True" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="300" Width="180" Height="120" AttachedDragMove="Surface" AttachedResize="Surface" />
	</Grid>
</Border>

SuRGeoNix avatar Nov 03 '22 18:11 SuRGeoNix

@SuRGeoNix on making KeepRatioOnResize="True" the video is playing but not able to see the video on screen. You can take any demo and just add KeepRatioOnResize="True". you will see the issue

saman1832 avatar Oct 26 '23 10:10 saman1832

@saman1832 Try to set PreferredLandscapeWidth="100" PreferredPortraitHeight="100" as it seems that for some reason it will not set a default value and stays at 0

SuRGeoNix avatar Oct 26 '23 11:10 SuRGeoNix

@SuRGeoNix that working fine. But if i am resizing the window then player width and height is not its takes time to readjust in the grid (suppose i have 10 grid and each grid is having flyleafhost) and potion mismatches

saman1832 avatar Oct 26 '23 13:10 saman1832

@saman1832 Maybe it's the Screen package that you use which makes it heavy? Check the https://github.com/SuRGeoNix/Flyleaf/blob/master/Tests/WpfFlyleafHost/MultipleAttached.xaml (add it to App.xaml) and let me know if you notice the same issue there?

SuRGeoNix avatar Oct 27 '23 00:10 SuRGeoNix