Commit 14b52d4c authored by Martin Finkel's avatar Martin Finkel

Add iOS sample

parent bd13132d
......@@ -11,7 +11,7 @@
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'Xamarin.iOS10'">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA</DefineConstants>
<DefineConstants>$(DefineConstants);MONO;IOS;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'Xamarin.Mac20'">
<DefineConstants>$(DefineConstants);MONO;COCOA</DefineConstants>
......
using Foundation;
using UIKit;
namespace LibVLCSharp.iOS.Sample
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
public override UIWindow Window
{
get;
set;
}
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow(UIScreen.MainScreen.Bounds) { RootViewController = new ViewController() };
// make the window visible
Window.MakeKeyAndVisible();
return true;
}
public override void OnResignActivation(UIApplication application)
{
// Invoked when the application is about to move from active to inactive state.
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
// or when the user quits the application and it begins the transition to the background state.
// Games should use this method to pause the game.
}
public override void DidEnterBackground(UIApplication application)
{
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
}
public override void WillEnterForeground(UIApplication application)
{
// Called as part of the transiton from background to active state.
// Here you can undo many of the changes made on entering the background.
}
public override void OnActivated(UIApplication application)
{
// Restart any tasks that were paused (or not yet started) while the application was inactive.
// If the application was previously in the background, optionally refresh the user interface.
}
public override void WillTerminate(UIApplication application)
{
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>LibVLCSharp.iOS.Sample</string>
<key>CFBundleIdentifier</key>
<string>com.companyname.LibVLCSharp.iOS.Sample</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>11.3</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{76840EFA-235B-46D8-8274-3240E1BBED5B}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>LibVLCSharp.iOS.Sample</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>LibVLCSharp.iOS.Sample</AssemblyName>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
<InterfaceDefinition Include="Resources\LaunchScreen.xib" />
<Content Include="Entitlements.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LibVLCSharp\LibVLCSharp.csproj">
<Project>{d1c3b7c4-713b-46b2-b33a-e9298c819921}</Project>
<Name>LibVLCSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Import Project="..\packages\VideoLAN.LibVLC.iOS.3.0.0-alpha\build\VideoLAN.LibVLC.iOS.targets" Condition="Exists('..\packages\VideoLAN.LibVLC.iOS.3.0.0-alpha\build\VideoLAN.LibVLC.iOS.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\VideoLAN.LibVLC.iOS.3.0.0-alpha\build\VideoLAN.LibVLC.iOS.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\VideoLAN.LibVLC.iOS.3.0.0-alpha\build\VideoLAN.LibVLC.iOS.targets'))" />
</Target>
</Project>
\ No newline at end of file
using UIKit;
namespace LibVLCSharp.iOS.Sample
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LibVLCSharp.iOS.Sample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LibVLCSharp.iOS.Sample")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("76840efa-235b-46d8-8274-3240e1bbed5b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207" />
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1" />
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" />
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder" />
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480" />
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2018 " textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines"
minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21" />
<fontDescription key="fontDescription" type="system" pointSize="17" />
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
<nil key="highlightedColor" />
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LibVLCSharp.iOS.Sample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines"
minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43" />
<fontDescription key="fontDescription" type="boldSystem" pointSize="36" />
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
<nil key="highlightedColor" />
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC" />
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk" />
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l" />
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0" />
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9" />
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g" />
</constraints>
<nil key="simulatedStatusBarMetrics" />
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics" />
<point key="canvasLocation" x="548" y="455" />
</view>
</objects>
</document>
using LibVLCSharp.Platforms.iOS;
using LibVLCSharp.Shared;
namespace LibVLCSharp.iOS.Sample
{
public class ViewController : VideoView
{
public override void ViewDidLoad()
{
AttachView(View);
MediaPlayer.Play(new Media(Instance, "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4",
Media.FromType.FromLocation));
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="VideoLAN.LibVLC.iOS" version="3.0.0-alpha" targetFramework="xamarinios10" />
</packages>
\ No newline at end of file
......@@ -23,48 +23,78 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibVLCSharp.Android.AWindow
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "LibVLCSharp.FSharp.Sample", "LibVLCSharp.FSharp.Sample\LibVLCSharp.FSharp.Sample.fsproj", "{86AF6388-68E1-42A3-A655-0A9799FF46C9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibVLCSharp.iOS.Sample", "LibVLCSharp.iOS.Sample\LibVLCSharp.iOS.Sample.csproj", "{76840EFA-235B-46D8-8274-3240E1BBED5B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|iPhone.Build.0 = Debug|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|x64.ActiveCfg = Debug|x64
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|x64.Build.0 = Debug|x64
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|x86.ActiveCfg = Debug|x86
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Debug|x86.Build.0 = Debug|x86
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|Any CPU.Build.0 = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|iPhone.ActiveCfg = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|iPhone.Build.0 = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|x64.ActiveCfg = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|x64.Build.0 = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|x86.ActiveCfg = Release|Any CPU
{FA6CFA75-231B-4643-B82A-F88A08F0F3F9}.Release|x86.Build.0 = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|iPhone.Build.0 = Debug|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|x64.ActiveCfg = Debug|x64
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|x64.Build.0 = Debug|x64
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|x86.ActiveCfg = Debug|x86
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Debug|x86.Build.0 = Debug|x86
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|Any CPU.Build.0 = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|iPhone.ActiveCfg = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|iPhone.Build.0 = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|x64.ActiveCfg = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|x64.Build.0 = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|x86.ActiveCfg = Release|Any CPU
{1C2511B2-DB4E-4A0E-AA3D-F03657BFB691}.Release|x86.Build.0 = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|iPhone.Build.0 = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|x64.ActiveCfg = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|x64.Build.0 = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|x86.ActiveCfg = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Debug|x86.Build.0 = Debug|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|Any CPU.Build.0 = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|iPhone.ActiveCfg = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|iPhone.Build.0 = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|x64.ActiveCfg = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|x64.Build.0 = Release|Any CPU
{D1C3B7C4-713B-46B2-B33A-E9298C819921}.Release|x86.ActiveCfg = Release|Any CPU
......@@ -72,6 +102,12 @@ Global
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|iPhone.Build.0 = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|x64.ActiveCfg = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|x64.Build.0 = Debug|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Debug|x64.Deploy.0 = Debug|Any CPU
......@@ -81,6 +117,12 @@ Global
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|Any CPU.Build.0 = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|Any CPU.Deploy.0 = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|iPhone.ActiveCfg = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|iPhone.Build.0 = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|iPhone.Deploy.0 = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|x64.ActiveCfg = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|x64.Build.0 = Release|Any CPU
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|x64.Deploy.0 = Release|Any CPU
......@@ -89,28 +131,54 @@ Global
{00419085-4455-45D4-84A0-0A80D6174D25}.Release|x86.Deploy.0 = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|Any CPU.Build.0 = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|iPhone.Build.0 = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|x64.ActiveCfg = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|x64.Build.0 = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|x86.ActiveCfg = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Debug|x86.Build.0 = Debug|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|Any CPU.ActiveCfg = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|Any CPU.Build.0 = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|iPhone.ActiveCfg = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|iPhone.Build.0 = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|x64.ActiveCfg = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|x64.Build.0 = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|x86.ActiveCfg = Release|Any CPU
{239A82A5-19A1-4382-8F9B-4A9705648017}.Release|x86.Build.0 = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|x64.ActiveCfg = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|x64.Build.0 = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|x86.ActiveCfg = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Debug|x86.Build.0 = Debug|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|Any CPU.Build.0 = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|iPhone.ActiveCfg = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|x64.ActiveCfg = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|x64.Build.0 = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|x86.ActiveCfg = Release|Any CPU
{86AF6388-68E1-42A3-A655-0A9799FF46C9}.Release|x86.Build.0 = Release|Any CPU
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Debug|Any CPU.ActiveCfg = Debug|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Debug|iPhone.ActiveCfg = Debug|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Debug|iPhone.Build.0 = Debug|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Debug|x64.ActiveCfg = Debug|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Debug|x86.ActiveCfg = Debug|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Release|Any CPU.ActiveCfg = Release|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Release|iPhone.ActiveCfg = Release|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Release|iPhone.Build.0 = Release|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Release|x64.ActiveCfg = Release|iPhone
{76840EFA-235B-46D8-8274-3240E1BBED5B}.Release|x86.ActiveCfg = Release|iPhone
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -4,7 +4,7 @@
<Summary>.NET bindings for LibVLC</Summary>
<Description>.NET bindings for LibVLC</Description>
<PackageTags>libvlc native xamarin .net video audio media mediaplayer</PackageTags>
<TargetFrameworks>netstandard2.0;MonoAndroid80;net461;netcoreapp2.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;MonoAndroid80;net461;netcoreapp2.0;Xamarin.iOS10</TargetFrameworks>
<RootNamespace>LibVLCSharp</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);</DefineConstants>
......@@ -29,7 +29,7 @@
<Compile Include="Platforms\Android\**\*.cs" />
<ProjectReference Include="..\LibVLCSharp.Android.AWindow\LibVLCSharp.Android.AWindow.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'Xamarin.iOS10' ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS'))">
<Compile Include="Platforms\iOS\**\*.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'Xamarin.TVOS10' ">
......
using System;
using LibVLCSharp.Shared;
using UIKit;
namespace LibVLCSharp.Platforms.iOS
{
public abstract class VideoView : UIViewController, IVideoView
{
protected VideoView()
{
Instance = new Instance();
MediaPlayer = new MediaPlayer(Instance);
}
public MediaPlayer MediaPlayer { get; }
public Instance Instance { get; }
public void AttachView(object surface)
{
if(surface == null) throw new NullReferenceException(nameof(surface));
if (surface is UIView uiView)
{
MediaPlayer.NsObject = uiView.Handle;
}
}
public void DetachView()
{
MediaPlayer.NsObject = IntPtr.Zero;
}
}
}
\ No newline at end of file
namespace LibVLCSharp.Shared
{
public interface IVideoView
{
MediaPlayer MediaPlayer { get; }
Instance Instance { get; }
void AttachView(object surface);
void DetachView();
}
}
......@@ -420,14 +420,14 @@ namespace LibVLCSharp.Shared
bool CloseLogFile()
{
if (_logFileHandle == IntPtr.Zero) return true;
#if !IOS
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return Native.fcloseWindows(_logFileHandle) == 0;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
return Native.fcloseLinux(_logFileHandle) == 0;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return Native.fcloseMac(_logFileHandle) == 0;
#endif
return false;
}
......@@ -488,7 +488,7 @@ namespace LibVLCSharp.Shared
IntPtr NativeFilePtr(string filename)
{
var filePtr = IntPtr.Zero;
#if !IOS
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Native._wfopen_s(out filePtr, filename);
......@@ -501,7 +501,7 @@ namespace LibVLCSharp.Shared
{
filePtr = Native.fopenMac(filename);
}
#endif
if (filePtr == IntPtr.Zero)
throw new VLCException("Could not get FILE * for log_set_file");
......
......@@ -65,7 +65,7 @@ namespace LibVLCSharp
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_stop")]
internal static extern void LibVLCMediaPlayerStop(IntPtr mediaPlayer);
#if COCOA
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_set_nsobject")]
......@@ -75,7 +75,7 @@ namespace LibVLCSharp
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_get_nsobject")]
internal static extern IntPtr LibVLCMediaPlayerGetNsobject(IntPtr mediaPlayer);
#endif
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_set_xwindow")]
......@@ -699,6 +699,12 @@ namespace LibVLCSharp
/// <returns></returns>
public bool Play() => Native.LibVLCMediaPlayerPlay(NativeReference) == 0;
public bool Play(Media media)
{
Media = media;
return Play();
}
/// <summary>
/// Pause or resume (no effect if there is no media).
/// version LibVLC 1.1.1 or later
......@@ -713,10 +719,7 @@ namespace LibVLCSharp
/// <summary>
/// Toggle pause (no effect if there is no media)
/// </summary>
public void Pause()
{
Native.LibVLCMediaPlayerPause(NativeReference);
}
public void Pause() => Native.LibVLCMediaPlayerPause(NativeReference);
/// <summary>
/// Stop the playback (no effect if there is no media)
......@@ -724,11 +727,9 @@ namespace LibVLCSharp
/// This is synchronous, and will block until all VLC threads have been joined.
/// Calling this from a VLC callback is a bound to cause a deadlock.
/// </summary>
public void Stop()
{
Native.LibVLCMediaPlayerStop(NativeReference);
}
public void Stop() => Native.LibVLCMediaPlayerStop(NativeReference);
#if COCOA
/// <summary>
/// Get the NSView handler previously set
/// return the NSView handler or 0 if none where set
......@@ -752,7 +753,7 @@ namespace LibVLCSharp
get => Native.LibVLCMediaPlayerGetNsobject(NativeReference);
set => Native.LibVLCMediaPlayerSetNsobject(NativeReference, value);
}
#endif
/// <summary>
/// Set an X Window System drawable where the media player should render its video output.
/// The call takes effect when the playback starts. If it is already started, it might need to be stopped before changes apply.
......@@ -1614,14 +1615,14 @@ namespace LibVLCSharp
public bool SetRenderer(RendererItem rendererItem) =>
Native.LibVLCMediaPlayerSetRenderer(NativeReference, rendererItem.NativeReference) == 0;
#region Enums
#region Enums
#endregion
#endregion
#region Callbacks
#region Callbacks
/// <summary>
/// <para>A LibVLC media player plays one media (usually in a custom drawable).</para>
......@@ -1806,7 +1807,7 @@ namespace LibVLCSharp
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void LibVLCVolumeCb(IntPtr data, float volume, [MarshalAs(UnmanagedType.I1)] bool mute);
#endregion
#endregion
}
/// <summary>Description for titles</summary>
......
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