如何在stacklayout/listview [Xamarin.Forms]的每一行中显示视频? [英] How to show a video in each row in a stacklayout / listview [Xamarin.Forms]?

查看:163
本文介绍了如何在stacklayout/listview [Xamarin.Forms]的每一行中显示视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用插件 https://github.com/Baseflow/XamarinMediaManager 视频支持.

I am using the plugin https://github.com/Baseflow/XamarinMediaManager where they have video support.

我成功使用它并能够播放视频,但是现在我尝试在堆栈布局列表(类似于instagram或twitter feed)中显示多个视频,那么我们遇到了问题.

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.

因此,我将列表中的每个项目都绑定到一个唯一的视频URL,但是,当我滚动浏览列表时,该视频会在彼此之上显示1st/同一视频在所有行上都可以重复使用,即使该视频只能在1.

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>

因此,每一行的标题都加载得很好,表明绑定等没有什么错.如上所述,问题是相同的1个视频出现在所有行上,即使它只能出现在一个行上,每行都附有一个独特的视频,与标签的标题"相同.

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.

任何人都知道MediaManager插件是否存在限制/错误,以及是否还有其他建议/路线可以去这里?

Anyone know if there is a limitation/bug with the MediaManager plugin and if there is any other suggestion/route to go here?

推荐答案

您必须向VideoView提供适当的HeightRequest,否则,如果未设置它,则会造成问题.

You have to give proper HeightRequest to your VideoView otherwise it create problem if you did't set it.

这篇关于如何在stacklayout/listview [Xamarin.Forms]的每一行中显示视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆