Commit dee75209 authored by Martin Finkel's avatar Martin Finkel

Apple samples: Dispose resources

parent c51d9a73
......@@ -31,7 +31,9 @@ namespace LibVLCSharp.Mac.Sample
View = _videoView;
_videoView.MediaPlayer.Play(new Media(_libVLC, new Uri("https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4")));
var media = new Media(_libVLC, new Uri("https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"));
_videoView.MediaPlayer.Play(media);
media.Dispose();
}
public override NSObject RepresentedObject
......@@ -46,5 +48,13 @@ namespace LibVLCSharp.Mac.Sample
// Update the view, if already loaded.
}
}
}
public override void ViewWillDisappear()
{
base.ViewWillDisappear();
_mediaPlayer.Dispose();
_libVLC.Dispose();
}
}
}
\ No newline at end of file
......@@ -24,6 +24,7 @@
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
......@@ -34,6 +35,7 @@
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<ConsolePause>false</ConsolePause>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
......@@ -48,6 +50,7 @@
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
......@@ -59,6 +62,7 @@
<MtouchArch>ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="Main.cs" />
......
using LibVLCSharp.Platforms.iOS;
using LibVLCSharp.Shared;
using System;
using UIKit;
namespace LibVLCSharp.iOS.Sample
......@@ -22,7 +22,16 @@ namespace LibVLCSharp.iOS.Sample
View = _videoView;
_videoView.MediaPlayer.Play(new Media(_libVLC, new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")));
using var media = new Media(_libVLC, new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"));
_videoView.MediaPlayer.Play(media);
}
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
_mediaPlayer.Dispose();
_libVLC.Dispose();
}
}
}
......@@ -22,7 +22,19 @@ namespace LibVLCSharp.tvOS.Sample
View = _videoView;
_videoView.MediaPlayer.Play(new Media(_libVLC, new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")));
var media = new Media(_libVLC, new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"));
_videoView.MediaPlayer.Play(media);
media.Dispose();
}
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
_mediaPlayer.Dispose();
_libVLC.Dispose();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment