-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sample application to show how to use the AirPlay library along w…
…ith UIActivity (iOS6+) or not (<iOS6)
- Loading branch information
Showing
31 changed files
with
344 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
*.userprefs | ||
bin/ | ||
bin/ | ||
obj/ |
Binary file added
BIN
+167 KB
airpic-ios/687px-Leontopithecus_rosalia_-_Copenhagen_Zoo_-_DSC09082.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?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>UIDeviceFamily</key> | ||
<array> | ||
<integer>1</integer> | ||
<integer>2</integer> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array/> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array/> | ||
<key>MinimumOSVersion</key> | ||
<string>5.0</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>AirPicDemo</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>poupou.airpic.demo</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>CFBundleIconFiles</key> | ||
<array> | ||
<string>Icon</string> | ||
<string>Icon@2x</string> | ||
<string>Icon-72</string> | ||
<string>Icon-72@2x</string> | ||
<string>Icon-Small</string> | ||
<string>Icon-Small@2x</string> | ||
<string>Icon-Small-50</string> | ||
<string>Icon-Small-50@2x</string> | ||
</array> | ||
<key>UIPrerenderedIcon</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
AirPic Demo | ||
=========== | ||
|
||
This is a MonoTouch / C# sample for using the ``Poupou.AirPlay.dll`` assembly. | ||
It's also a sample on how to use iOS6 new ``UIActivity`` with a MonoTouch application. | ||
|
||
The application simply shows an image (see credits) and let you send it to any, non password-protected, AirPlay device (e.g. an AppleTV) on your network. | ||
|
||
I found this useful (for my own needs) and there were no API in iOS to send pictures (only video and sounds) without the use of any private/undocumented API (which I rather avoid). | ||
|
||
|
||
License | ||
======= | ||
|
||
The sample, like the assembly, is licensed under the | ||
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Picture from [Daderot](http://en.wikipedia.org/wiki/File:Leontopithecus_rosalia_-_Copenhagen_Zoo_-_DSC09082.JPG) | ||
available under the Creative Commons [CC0 1.0 Universal Public Domain Dedication](http://creativecommons.org/publicdomain/zero/1.0/deed.en) | ||
|
||
|
||
Screenshots | ||
=========== | ||
|
||
![iOS 5.1](airpic-iphone-51.png "iOS 5.1") | ||
|
||
![iOS 6.0](airpic-iphone-60.png "iOS 6.0") | ||
|
||
![iOS 5.1](airpic-ipad-51.png "iOS 5.1") | ||
|
||
![iOS 6.0](airpic-ipad-60.png "iOS 6.0") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Authors: | ||
// Sebastien Pouliot <sebastien@xamarin.com> | ||
// | ||
// Copyright 2012 Xamarin Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
|
||
using System; | ||
using MonoTouch.Foundation; | ||
using MonoTouch.UIKit; | ||
using Poupou.AirPlay; | ||
|
||
namespace AirPicDemo { | ||
|
||
public class ImageViewController : UIViewController { | ||
|
||
UIPopoverController popup; | ||
UIImageView image_view; | ||
|
||
public ImageViewController () | ||
{ | ||
Title = "AirPic Demo"; | ||
AirPlayBrowser.Enabled = true; | ||
|
||
var bounds = UIScreen.MainScreen.Bounds; | ||
image_view = new UIImageView (bounds); | ||
image_view.Image = UIImage.FromFile ("687px-Leontopithecus_rosalia_-_Copenhagen_Zoo_-_DSC09082.JPG"); | ||
image_view.Image.Scale (bounds.Size); | ||
Add (image_view); | ||
|
||
UIBarButtonItem action = null; | ||
action = new UIBarButtonItem (UIBarButtonSystemItem.Action, delegate { | ||
if (image_view.Image == null) | ||
return; | ||
// UIActivity is only for iOS6+ but that should not limit us :-) | ||
if (UIDevice.CurrentDevice.CheckSystemVersion (6,0)) { | ||
UIActivityViewController a = new UIActivityViewController (new [] { image_view.Image }, | ||
UIAirPlayActivity.GetCurrentActivities ()); | ||
if (AppDelegate.RunningOnIPad) { | ||
popup = new UIPopoverController (a); | ||
popup.PresentFromBarButtonItem (action, UIPopoverArrowDirection.Up, true); | ||
} else { | ||
PresentViewController (a, true, null); | ||
} | ||
} else { | ||
var devices = AirPlayBrowser.GetDeviceNames (); | ||
UIActionSheet a = new UIActionSheet (null, null, "Cancel", null, devices); | ||
a.Clicked += (object sender, UIButtonEventArgs e) => { | ||
int index = e.ButtonIndex; | ||
// ignore Cancel button | ||
if (index < devices.Length) { | ||
var device = AirPlayBrowser.GetDevice (devices [index]); | ||
if (device != null) // they can disappear anytime | ||
device.SendTo (image_view.Image, null); | ||
} | ||
}; | ||
a.ShowFrom (NavigationItem.RightBarButtonItem, true); | ||
} | ||
}); | ||
NavigationItem.RightBarButtonItem = action; | ||
} | ||
} | ||
|
||
[Register ("AppDelegate")] | ||
public partial class AppDelegate : UIApplicationDelegate { | ||
|
||
UIWindow window; | ||
|
||
public static bool RunningOnIPad { get; private set; } | ||
|
||
public override bool FinishedLaunching (UIApplication app, NSDictionary options) | ||
{ | ||
RunningOnIPad = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad; | ||
|
||
window = new UIWindow (UIScreen.MainScreen.Bounds); | ||
window.RootViewController = new UINavigationController (new ImageViewController ()); | ||
window.MakeKeyAndVisible (); | ||
return true; | ||
} | ||
|
||
public class Application | ||
{ | ||
static void Main (string[] args) | ||
{ | ||
UIApplication.Main (args, null, "AppDelegate"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> | ||
<ProductVersion>10.0.0</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{4A81A178-FE43-4E1B-A0DC-D1D34D1CCF90}</ProjectGuid> | ||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>airpicios</RootNamespace> | ||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> | ||
<AssemblyName>airpicios</AssemblyName> | ||
</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> | ||
<MtouchLink>None</MtouchLink> | ||
<MtouchDebug>True</MtouchDebug> | ||
<MtouchI18n /> | ||
<MtouchArch>ARMv7</MtouchArch> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>True</Optimize> | ||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>False</ConsolePause> | ||
<MtouchLink>None</MtouchLink> | ||
</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> | ||
<MtouchDebug>True</MtouchDebug> | ||
<CodesignKey>iPhone Developer</CodesignKey> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>True</Optimize> | ||
<OutputPath>bin\iPhone\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>False</ConsolePause> | ||
<CodesignKey>iPhone Developer</CodesignKey> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>True</Optimize> | ||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<BuildIpa>True</BuildIpa> | ||
<ConsolePause>False</ConsolePause> | ||
<CodesignProvision>Automatic:AdHoc</CodesignProvision> | ||
<CodesignKey>iPhone Distribution</CodesignKey> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>True</Optimize> | ||
<OutputPath>bin\iPhone\AppStore</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>False</ConsolePause> | ||
<CodesignKey>iPhone Distribution</CodesignKey> | ||
<CodesignProvision>Automatic:AppStore</CodesignProvision> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="monotouch" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="Resources\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Info.plist" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Sample.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Poupou.AirPlay\Poupou.AirPlay.csproj"> | ||
<Project>{82CB7B9A-6C9E-4AF9-9D6B-243D63A6D739}</Project> | ||
<Name>Poupou.AirPlay</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="687px-Leontopithecus_rosalia_-_Copenhagen_Zoo_-_DSC09082.JPG" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<BundleResource Include="Resources\Icon.png" /> | ||
<BundleResource Include="Resources\Icon%402x.png" /> | ||
<BundleResource Include="Resources\Icon-72.png" /> | ||
<BundleResource Include="Resources\Icon-72%402x.png" /> | ||
<BundleResource Include="Resources\Icon-Small.png" /> | ||
<BundleResource Include="Resources\Icon-Small%402x.png" /> | ||
<BundleResource Include="Resources\Icon-Small-50.png" /> | ||
<BundleResource Include="Resources\Icon-Small-50%402x.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ITunesArtwork Include="iTunesArtwork%402x" /> | ||
<ITunesArtwork Include="iTunesArtwork" /> | ||
</ItemGroup> | ||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters