问题
I am using the plugin https://github.com/Baseflow/XamarinMediaManager where they have video support.
I successfully use it and am able to play a video, but now that i try to display multiple videos in a stacklayout list (similiar to a instagram or twitter feed), then we are running into issues.
So i bind each item in the list to a unique video URL, but once i scroll through the list, then the video appears 1st on top of eachother/the same video is reused on all rows, even though it should only be in 1.
<StackLayout BindableLayout.ItemsSource="{Binding FlowList}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<StackLayout>
<Label Text="{Binding Title}"/>
<mm:VideoView VerticalOptions="FillAndExpand"
AutoPlay="True"
Source="{Binding Video}"
VideoAspect="AspectFill"/>
</StackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
So the Title for each row loads well, indicating that there is nothing wrong going on with the binding etc. The issue as explained above is that the same 1 video appears on all rows, even though it should only be on one and each row has a unique video attached to it, same as the "Title" for the label.
Anyone know if there is a limitation/bug with the MediaManager plugin and if there is any other suggestion/route to go here?
回答1:
You have to give proper HeightRequest to your VideoView otherwise it create problem if you did't set it.
来源:https://stackoverflow.com/questions/62253745/how-to-show-a-video-in-each-row-in-a-stacklayout-listview-xamarin-forms