How to use Xamarin.Forms MediaManager library with MVVM to play youtube videos
I'm trying to get working the MediaManager library playing a couple videos from youtube using MVVM approach.
My idea is to have a single view where initially is loaded a video, once the user watched the first loaded video he can click a button to see another video in the same view.
I can't find many examples on the internet related about how to accomplish this using MVVM, every example I've found uses the codebehind approach but my app is created in full MVVM so I need to get it working like that.
This is what I've done by now.
XAML
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:behaviors="clr-namespace:Behaviors;assembly=Behaviors"
xmlns:mediamanager="clr-namespace:Plugin.MediaManager.Forms;assembly=Plugin.MediaManager.Forms"
x:Class="VideoView"
BindingContext="Binding VideoViewModel, Source=StaticResource ServiceLocator">
<ContentPage.Behaviors>
<behaviors:EventHandlerBehavior EventName="Appearing">
<behaviors:InvokeCommandAction Command="Binding PageAppearingCommand" />
</behaviors:EventHandlerBehavior>
</ContentPage.Behaviors>
<StackLayout Margin="10,60,10,0">
<Label x:Name="LblMsg"/>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<mediamanager:VideoView x:Name="TrainingVideoPlayer"
AspectMode="AspectFill"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
<StackLayout VerticalOptions="End" HorizontalOptions="FillAndExpand">
<ProgressBar x:Name="progress" HeightRequest="10" Progress="Binding ProgressStatus, Mode=TwoWay" />
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Spacing="10" VerticalOptions="End">
<Image x:Name="ImgPlay"
Source="video_play.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PlayTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgPause"
Source="video_pause.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PauseTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgStop"
Source="video_stop.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding StopTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
</StackLayout>
</StackLayout>
</Grid>
<Button x:Name="BtnNext" Command="Binding NextCommand"/>
</StackLayout>
</ContentPage>
ViewModel
public class VideoViewModel : AppBaseViewModel
//Commands
public ICommand PageAppearingCommand get; set;
public ICommand PlayTappedCommand get; set;
public ICommand PauseTappedCommand get; set;
public ICommand StopTappedCommand get; set;
public ICommand NextCommand get; set;
//Fields
private double _progressStatus;
private string youtubevideourl;
//Properties
public double ProgressStatus
get => _progressStatus;
set
if (Set(ref _progressStatus, value))
RaisePropertyChanged(() => ProgressStatus);
public VideoViewModel()
PageAppearingCommand = new Command(OnPageAppearing);
PlayTappedCommand = new Command(OnImgPlay_Tapped);
PauseTappedCommand = new Command(OnImgPause_Tapped);
StopTappedCommand = new Command(OnImgStop_Tapped);
NextCommand = new Command(OnBtnNext_Click);
youtubevideourl = "https://urloftheyoutubevideo";
private async void OnPageAppearing()
await CrossMediaManager.Current.Stop();
//Sets the videoplayer events to control playback status
CrossMediaManager.Current.PlayingChanged += VideoPlayer_PlayingChanged;
CrossMediaManager.Current.MediaFinished += VideoPlayer_MediaFinished;
private async void OnImgPlay_Tapped()
await CrossMediaManager.Current.Play(youtubevideourl, MediaFileType.Video);
private async void OnImgPause_Tapped()
await CrossMediaManager.Current.Pause();
private async void OnImgStop_Tapped()
await CrossMediaManager.Current.Stop();
private void VideoPlayer_PlayingChanged(object sender, PlayingChangedEventArgs e)
Device.BeginInvokeOnMainThread(() =>
ProgressStatus = e.Progress;
);
private void VideoPlayer_MediaFinished(object sender, MediaFinishedEventArgs e)
//Some logic
private async void OnBtnNext_Click()
//logic to load the next video url
Using this code I can execute play/pause/stop methods of the MediaManager but nothing happens in the View, I cant even see 1 second of the youtube video.
I will appreciate your help
Note: I installed the MediaManager nuget package in my three projects: Android, iOS and NetStandard library
Note2: One of my requirements is to guarantee as much as possible the user watched the whole video before moving to the next one (the value will be stored in an external DB), so any solution different to this one must follow this requirement
xamarin xamarin.forms mvvm-light
|
show 6 more comments
I'm trying to get working the MediaManager library playing a couple videos from youtube using MVVM approach.
My idea is to have a single view where initially is loaded a video, once the user watched the first loaded video he can click a button to see another video in the same view.
I can't find many examples on the internet related about how to accomplish this using MVVM, every example I've found uses the codebehind approach but my app is created in full MVVM so I need to get it working like that.
This is what I've done by now.
XAML
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:behaviors="clr-namespace:Behaviors;assembly=Behaviors"
xmlns:mediamanager="clr-namespace:Plugin.MediaManager.Forms;assembly=Plugin.MediaManager.Forms"
x:Class="VideoView"
BindingContext="Binding VideoViewModel, Source=StaticResource ServiceLocator">
<ContentPage.Behaviors>
<behaviors:EventHandlerBehavior EventName="Appearing">
<behaviors:InvokeCommandAction Command="Binding PageAppearingCommand" />
</behaviors:EventHandlerBehavior>
</ContentPage.Behaviors>
<StackLayout Margin="10,60,10,0">
<Label x:Name="LblMsg"/>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<mediamanager:VideoView x:Name="TrainingVideoPlayer"
AspectMode="AspectFill"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
<StackLayout VerticalOptions="End" HorizontalOptions="FillAndExpand">
<ProgressBar x:Name="progress" HeightRequest="10" Progress="Binding ProgressStatus, Mode=TwoWay" />
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Spacing="10" VerticalOptions="End">
<Image x:Name="ImgPlay"
Source="video_play.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PlayTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgPause"
Source="video_pause.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PauseTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgStop"
Source="video_stop.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding StopTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
</StackLayout>
</StackLayout>
</Grid>
<Button x:Name="BtnNext" Command="Binding NextCommand"/>
</StackLayout>
</ContentPage>
ViewModel
public class VideoViewModel : AppBaseViewModel
//Commands
public ICommand PageAppearingCommand get; set;
public ICommand PlayTappedCommand get; set;
public ICommand PauseTappedCommand get; set;
public ICommand StopTappedCommand get; set;
public ICommand NextCommand get; set;
//Fields
private double _progressStatus;
private string youtubevideourl;
//Properties
public double ProgressStatus
get => _progressStatus;
set
if (Set(ref _progressStatus, value))
RaisePropertyChanged(() => ProgressStatus);
public VideoViewModel()
PageAppearingCommand = new Command(OnPageAppearing);
PlayTappedCommand = new Command(OnImgPlay_Tapped);
PauseTappedCommand = new Command(OnImgPause_Tapped);
StopTappedCommand = new Command(OnImgStop_Tapped);
NextCommand = new Command(OnBtnNext_Click);
youtubevideourl = "https://urloftheyoutubevideo";
private async void OnPageAppearing()
await CrossMediaManager.Current.Stop();
//Sets the videoplayer events to control playback status
CrossMediaManager.Current.PlayingChanged += VideoPlayer_PlayingChanged;
CrossMediaManager.Current.MediaFinished += VideoPlayer_MediaFinished;
private async void OnImgPlay_Tapped()
await CrossMediaManager.Current.Play(youtubevideourl, MediaFileType.Video);
private async void OnImgPause_Tapped()
await CrossMediaManager.Current.Pause();
private async void OnImgStop_Tapped()
await CrossMediaManager.Current.Stop();
private void VideoPlayer_PlayingChanged(object sender, PlayingChangedEventArgs e)
Device.BeginInvokeOnMainThread(() =>
ProgressStatus = e.Progress;
);
private void VideoPlayer_MediaFinished(object sender, MediaFinishedEventArgs e)
//Some logic
private async void OnBtnNext_Click()
//logic to load the next video url
Using this code I can execute play/pause/stop methods of the MediaManager but nothing happens in the View, I cant even see 1 second of the youtube video.
I will appreciate your help
Note: I installed the MediaManager nuget package in my three projects: Android, iOS and NetStandard library
Note2: One of my requirements is to guarantee as much as possible the user watched the whole video before moving to the next one (the value will be stored in an external DB), so any solution different to this one must follow this requirement
xamarin xamarin.forms mvvm-light
You can not use MediaManager to play YouTube videos, you would need to use an embeddedWebView
– SushiHangover
Nov 15 '18 at 15:07
@SushiHangover Documentation says it's possible to load remote videos from url
– Anon Dev
Nov 15 '18 at 15:09
Remote video streaming Yes, Youtube: No.
– SushiHangover
Nov 15 '18 at 15:10
@SushiHangover github.com/martijn00/XamarinMediaManager/blob/…
– Anon Dev
Nov 15 '18 at 15:15
You could use the native Youtube Player API on iOS and Android (it uses the installed Youtube App via an exposed Service/API), this does of course have usage restrictions. Most apps use theIFramebased player as this allows Youtube to serve ads, etc... as it does not have the native player restrictions
– SushiHangover
Nov 15 '18 at 15:16
|
show 6 more comments
I'm trying to get working the MediaManager library playing a couple videos from youtube using MVVM approach.
My idea is to have a single view where initially is loaded a video, once the user watched the first loaded video he can click a button to see another video in the same view.
I can't find many examples on the internet related about how to accomplish this using MVVM, every example I've found uses the codebehind approach but my app is created in full MVVM so I need to get it working like that.
This is what I've done by now.
XAML
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:behaviors="clr-namespace:Behaviors;assembly=Behaviors"
xmlns:mediamanager="clr-namespace:Plugin.MediaManager.Forms;assembly=Plugin.MediaManager.Forms"
x:Class="VideoView"
BindingContext="Binding VideoViewModel, Source=StaticResource ServiceLocator">
<ContentPage.Behaviors>
<behaviors:EventHandlerBehavior EventName="Appearing">
<behaviors:InvokeCommandAction Command="Binding PageAppearingCommand" />
</behaviors:EventHandlerBehavior>
</ContentPage.Behaviors>
<StackLayout Margin="10,60,10,0">
<Label x:Name="LblMsg"/>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<mediamanager:VideoView x:Name="TrainingVideoPlayer"
AspectMode="AspectFill"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
<StackLayout VerticalOptions="End" HorizontalOptions="FillAndExpand">
<ProgressBar x:Name="progress" HeightRequest="10" Progress="Binding ProgressStatus, Mode=TwoWay" />
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Spacing="10" VerticalOptions="End">
<Image x:Name="ImgPlay"
Source="video_play.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PlayTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgPause"
Source="video_pause.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PauseTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgStop"
Source="video_stop.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding StopTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
</StackLayout>
</StackLayout>
</Grid>
<Button x:Name="BtnNext" Command="Binding NextCommand"/>
</StackLayout>
</ContentPage>
ViewModel
public class VideoViewModel : AppBaseViewModel
//Commands
public ICommand PageAppearingCommand get; set;
public ICommand PlayTappedCommand get; set;
public ICommand PauseTappedCommand get; set;
public ICommand StopTappedCommand get; set;
public ICommand NextCommand get; set;
//Fields
private double _progressStatus;
private string youtubevideourl;
//Properties
public double ProgressStatus
get => _progressStatus;
set
if (Set(ref _progressStatus, value))
RaisePropertyChanged(() => ProgressStatus);
public VideoViewModel()
PageAppearingCommand = new Command(OnPageAppearing);
PlayTappedCommand = new Command(OnImgPlay_Tapped);
PauseTappedCommand = new Command(OnImgPause_Tapped);
StopTappedCommand = new Command(OnImgStop_Tapped);
NextCommand = new Command(OnBtnNext_Click);
youtubevideourl = "https://urloftheyoutubevideo";
private async void OnPageAppearing()
await CrossMediaManager.Current.Stop();
//Sets the videoplayer events to control playback status
CrossMediaManager.Current.PlayingChanged += VideoPlayer_PlayingChanged;
CrossMediaManager.Current.MediaFinished += VideoPlayer_MediaFinished;
private async void OnImgPlay_Tapped()
await CrossMediaManager.Current.Play(youtubevideourl, MediaFileType.Video);
private async void OnImgPause_Tapped()
await CrossMediaManager.Current.Pause();
private async void OnImgStop_Tapped()
await CrossMediaManager.Current.Stop();
private void VideoPlayer_PlayingChanged(object sender, PlayingChangedEventArgs e)
Device.BeginInvokeOnMainThread(() =>
ProgressStatus = e.Progress;
);
private void VideoPlayer_MediaFinished(object sender, MediaFinishedEventArgs e)
//Some logic
private async void OnBtnNext_Click()
//logic to load the next video url
Using this code I can execute play/pause/stop methods of the MediaManager but nothing happens in the View, I cant even see 1 second of the youtube video.
I will appreciate your help
Note: I installed the MediaManager nuget package in my three projects: Android, iOS and NetStandard library
Note2: One of my requirements is to guarantee as much as possible the user watched the whole video before moving to the next one (the value will be stored in an external DB), so any solution different to this one must follow this requirement
xamarin xamarin.forms mvvm-light
I'm trying to get working the MediaManager library playing a couple videos from youtube using MVVM approach.
My idea is to have a single view where initially is loaded a video, once the user watched the first loaded video he can click a button to see another video in the same view.
I can't find many examples on the internet related about how to accomplish this using MVVM, every example I've found uses the codebehind approach but my app is created in full MVVM so I need to get it working like that.
This is what I've done by now.
XAML
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:behaviors="clr-namespace:Behaviors;assembly=Behaviors"
xmlns:mediamanager="clr-namespace:Plugin.MediaManager.Forms;assembly=Plugin.MediaManager.Forms"
x:Class="VideoView"
BindingContext="Binding VideoViewModel, Source=StaticResource ServiceLocator">
<ContentPage.Behaviors>
<behaviors:EventHandlerBehavior EventName="Appearing">
<behaviors:InvokeCommandAction Command="Binding PageAppearingCommand" />
</behaviors:EventHandlerBehavior>
</ContentPage.Behaviors>
<StackLayout Margin="10,60,10,0">
<Label x:Name="LblMsg"/>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<mediamanager:VideoView x:Name="TrainingVideoPlayer"
AspectMode="AspectFill"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
<StackLayout VerticalOptions="End" HorizontalOptions="FillAndExpand">
<ProgressBar x:Name="progress" HeightRequest="10" Progress="Binding ProgressStatus, Mode=TwoWay" />
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Spacing="10" VerticalOptions="End">
<Image x:Name="ImgPlay"
Source="video_play.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PlayTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgPause"
Source="video_pause.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding PauseTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="ImgStop"
Source="video_stop.png"
HorizontalOptions="Center">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="Binding StopTappedCommand" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
</StackLayout>
</StackLayout>
</Grid>
<Button x:Name="BtnNext" Command="Binding NextCommand"/>
</StackLayout>
</ContentPage>
ViewModel
public class VideoViewModel : AppBaseViewModel
//Commands
public ICommand PageAppearingCommand get; set;
public ICommand PlayTappedCommand get; set;
public ICommand PauseTappedCommand get; set;
public ICommand StopTappedCommand get; set;
public ICommand NextCommand get; set;
//Fields
private double _progressStatus;
private string youtubevideourl;
//Properties
public double ProgressStatus
get => _progressStatus;
set
if (Set(ref _progressStatus, value))
RaisePropertyChanged(() => ProgressStatus);
public VideoViewModel()
PageAppearingCommand = new Command(OnPageAppearing);
PlayTappedCommand = new Command(OnImgPlay_Tapped);
PauseTappedCommand = new Command(OnImgPause_Tapped);
StopTappedCommand = new Command(OnImgStop_Tapped);
NextCommand = new Command(OnBtnNext_Click);
youtubevideourl = "https://urloftheyoutubevideo";
private async void OnPageAppearing()
await CrossMediaManager.Current.Stop();
//Sets the videoplayer events to control playback status
CrossMediaManager.Current.PlayingChanged += VideoPlayer_PlayingChanged;
CrossMediaManager.Current.MediaFinished += VideoPlayer_MediaFinished;
private async void OnImgPlay_Tapped()
await CrossMediaManager.Current.Play(youtubevideourl, MediaFileType.Video);
private async void OnImgPause_Tapped()
await CrossMediaManager.Current.Pause();
private async void OnImgStop_Tapped()
await CrossMediaManager.Current.Stop();
private void VideoPlayer_PlayingChanged(object sender, PlayingChangedEventArgs e)
Device.BeginInvokeOnMainThread(() =>
ProgressStatus = e.Progress;
);
private void VideoPlayer_MediaFinished(object sender, MediaFinishedEventArgs e)
//Some logic
private async void OnBtnNext_Click()
//logic to load the next video url
Using this code I can execute play/pause/stop methods of the MediaManager but nothing happens in the View, I cant even see 1 second of the youtube video.
I will appreciate your help
Note: I installed the MediaManager nuget package in my three projects: Android, iOS and NetStandard library
Note2: One of my requirements is to guarantee as much as possible the user watched the whole video before moving to the next one (the value will be stored in an external DB), so any solution different to this one must follow this requirement
xamarin xamarin.forms mvvm-light
xamarin xamarin.forms mvvm-light
edited Nov 15 '18 at 15:33
Anon Dev
asked Nov 15 '18 at 15:01
Anon DevAnon Dev
6741718
6741718
You can not use MediaManager to play YouTube videos, you would need to use an embeddedWebView
– SushiHangover
Nov 15 '18 at 15:07
@SushiHangover Documentation says it's possible to load remote videos from url
– Anon Dev
Nov 15 '18 at 15:09
Remote video streaming Yes, Youtube: No.
– SushiHangover
Nov 15 '18 at 15:10
@SushiHangover github.com/martijn00/XamarinMediaManager/blob/…
– Anon Dev
Nov 15 '18 at 15:15
You could use the native Youtube Player API on iOS and Android (it uses the installed Youtube App via an exposed Service/API), this does of course have usage restrictions. Most apps use theIFramebased player as this allows Youtube to serve ads, etc... as it does not have the native player restrictions
– SushiHangover
Nov 15 '18 at 15:16
|
show 6 more comments
You can not use MediaManager to play YouTube videos, you would need to use an embeddedWebView
– SushiHangover
Nov 15 '18 at 15:07
@SushiHangover Documentation says it's possible to load remote videos from url
– Anon Dev
Nov 15 '18 at 15:09
Remote video streaming Yes, Youtube: No.
– SushiHangover
Nov 15 '18 at 15:10
@SushiHangover github.com/martijn00/XamarinMediaManager/blob/…
– Anon Dev
Nov 15 '18 at 15:15
You could use the native Youtube Player API on iOS and Android (it uses the installed Youtube App via an exposed Service/API), this does of course have usage restrictions. Most apps use theIFramebased player as this allows Youtube to serve ads, etc... as it does not have the native player restrictions
– SushiHangover
Nov 15 '18 at 15:16
You can not use MediaManager to play YouTube videos, you would need to use an embedded
WebView– SushiHangover
Nov 15 '18 at 15:07
You can not use MediaManager to play YouTube videos, you would need to use an embedded
WebView– SushiHangover
Nov 15 '18 at 15:07
@SushiHangover Documentation says it's possible to load remote videos from url
– Anon Dev
Nov 15 '18 at 15:09
@SushiHangover Documentation says it's possible to load remote videos from url
– Anon Dev
Nov 15 '18 at 15:09
Remote video streaming Yes, Youtube: No.
– SushiHangover
Nov 15 '18 at 15:10
Remote video streaming Yes, Youtube: No.
– SushiHangover
Nov 15 '18 at 15:10
@SushiHangover github.com/martijn00/XamarinMediaManager/blob/…
– Anon Dev
Nov 15 '18 at 15:15
@SushiHangover github.com/martijn00/XamarinMediaManager/blob/…
– Anon Dev
Nov 15 '18 at 15:15
You could use the native Youtube Player API on iOS and Android (it uses the installed Youtube App via an exposed Service/API), this does of course have usage restrictions. Most apps use the
IFrame based player as this allows Youtube to serve ads, etc... as it does not have the native player restrictions– SushiHangover
Nov 15 '18 at 15:16
You could use the native Youtube Player API on iOS and Android (it uses the installed Youtube App via an exposed Service/API), this does of course have usage restrictions. Most apps use the
IFrame based player as this allows Youtube to serve ads, etc... as it does not have the native player restrictions– SushiHangover
Nov 15 '18 at 15:16
|
show 6 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322264%2fhow-to-use-xamarin-forms-mediamanager-library-with-mvvm-to-play-youtube-videos%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322264%2fhow-to-use-xamarin-forms-mediamanager-library-with-mvvm-to-play-youtube-videos%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can not use MediaManager to play YouTube videos, you would need to use an embedded
WebView– SushiHangover
Nov 15 '18 at 15:07
@SushiHangover Documentation says it's possible to load remote videos from url
– Anon Dev
Nov 15 '18 at 15:09
Remote video streaming Yes, Youtube: No.
– SushiHangover
Nov 15 '18 at 15:10
@SushiHangover github.com/martijn00/XamarinMediaManager/blob/…
– Anon Dev
Nov 15 '18 at 15:15
You could use the native Youtube Player API on iOS and Android (it uses the installed Youtube App via an exposed Service/API), this does of course have usage restrictions. Most apps use the
IFramebased player as this allows Youtube to serve ads, etc... as it does not have the native player restrictions– SushiHangover
Nov 15 '18 at 15:16