Open gutosys opened 3 years ago
Sorry I'm not sure what you mean. What are you setting IsVisible
to? Please fill out more details on the template. Is this on iOS, Android, UWP? All? Please share some relevant code and/or a reproduction project.
Sorry I'm not sure what you mean. What are you setting
IsVisible
to? Please fill out more details on the template. Is this on iOS, Android, UWP? All? Please share some relevant code and/or a reproduction project.
I intend to show the video on the screen, only after recording the video without taking up space on the screen if it has not been recorded, so IsVisible, controlling the layout.
If I understand you correctly what you expect is:
Is that correct? And that is not what is happening now?
Again; some code or a reproduction sample would be greatly appreciated
If I understand you correctly what you expect is:
- MediaElement.IsVisible == false, it doesn't take up any space
- You start loading the video
- If the loading is complete and you are ready to play it only then set IsVisible to true and it should show up
Is that correct? And that is not what is happening now?
Again; some code or a reproduction sample would be greatly appreciated
Exactly this !
The ViewModel:
async Task TapVideo()
{
if (VideoPath != null)
{
await App.Current.MainPage.DisplayAlert("Número máximo de vídeos permitidos: 1", string.Empty, "OK");
return;
}
if (MediaPicker.IsCaptureSupported)
{
var result = await MediaPicker.CaptureVideoAsync();
if (result != null)
{
IsVideo = true;
var stream = await result.OpenReadAsync();
VideoPath = result.FullPath;
fileResultList.Add(result);
}
}
}
The View:
<StackLayout Margin="0,20,0,20" IsVisible="{Binding IsVideo}">
<Label
Style="{StaticResource LabelTitle}"
Text="Vídeo" />
<xct:MediaElement
AutoPlay="False"
HeightRequest="100"
HorizontalOptions="Start"
Source="{Binding VideoPath}"
WidthRequest="300" />
</StackLayout>
If I use IsVisible, in StackLayout, the vídeo not show anymore, if I use on MediaElement, The video not show anymore. If I remove de IsVisible, the vídeo shows up on the screen.
@gutosys I have experienced the same issue. If the element containing the MediaElement is hidden at initialization, it will not show any video. My workaround at the moment is to let the element be visible at initialization and quickly hide it OnAppearing(). You may need some delay before hiding it so that the MediaElement will properly load the video.
One more thing I have tried is inside the element containing the MediaElement, I make a button and start the video on click and it also works.
Description
Steps to Reproduce
Expected Behavior
Show the vídeo
Actual Behavior
Not show the vídeo
Basic Information
Version with issue:
Last known good version:
IDE:
Platform Target Frameworks:
Android Support Library Version:
Nuget Packages:
Affected Devices:
Workaround
Reproduction imagery
Reproduction Link