Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Commit the Sound and MoviePlayback samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrp committed Feb 13, 2012
1 parent ac789e9 commit 30fb7b8
Show file tree
Hide file tree
Showing 50 changed files with 1,972 additions and 0 deletions.
1 change: 1 addition & 0 deletions MoviePlayback/Metadata.xml
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" ?><SampleMetadata> <ID>583bff79-dc04-4c39-9348-ec1d66e93b41</ID> <IsFullApplication>false</IsFullApplication> <Level>Intermediate</Level> <Tags>Media</Tags></SampleMetadata>
Expand Down
26 changes: 26 additions & 0 deletions MoviePlayback/MoviePlayback.sln
@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoviePlayback", "MoviePlaybackSample\MoviePlayback.csproj", "{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Debug|iPhone.ActiveCfg = Debug|iPhone
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Debug|iPhone.Build.0 = Debug|iPhone
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Release|iPhone.ActiveCfg = Release|iPhone
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Release|iPhone.Build.0 = Release|iPhone
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = MoviePlaybackSample\MoviePlayback.csproj
EndGlobalSection
EndGlobal
38 changes: 38 additions & 0 deletions MoviePlayback/MoviePlaybackSample/AppDelegate.cs
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace MoviePlaybackSample
{
// 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 partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
MoviePlaybackSampleViewController viewController;

//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);

viewController = new MoviePlaybackSampleViewController ();
window.RootViewController = viewController;
window.MakeKeyAndVisible ();

return true;
}
}
}

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MoviePlayback/MoviePlaybackSample/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MoviePlayback/MoviePlaybackSample/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions MoviePlayback/MoviePlaybackSample/Info.plist
@@ -0,0 +1,38 @@
<?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>MoviePlaybackSample</string>
<key>CFBundleIconFiles</key>
<array>
<string>Images/Icons/57_icon.png</string>
<string>Images/Icons/114_icon.png</string>
<string>Images/Icons/72_icon.png</string>
<string>Images/Icons/29_icon.png</string>
<string>Images/Icons/58_icon.png</string>
<string>Images/Icons/50_icon.png</string>
<string>Images/Icons/512_icon.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>583bff79-dc04-4c39-9348-ec1d66e93b41</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</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>
19 changes: 19 additions & 0 deletions MoviePlayback/MoviePlaybackSample/Main.cs
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace MoviePlaybackSample
{
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");
}
}
}
102 changes: 102 additions & 0 deletions MoviePlayback/MoviePlaybackSample/MoviePlayback.csproj
@@ -0,0 +1,102 @@
<?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>{822B0D9D-FA7C-4BC5-9DA9-D91B0AE2CB63}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>MoviePlaybackSample</RootNamespace>
<AssemblyName>MoviePlaybackSample</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>
<MtouchDebug>true</MtouchDebug>
<MtouchProfiling>true</MtouchProfiling>
<MtouchLink>None</MtouchLink>
<MtouchI18n />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</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>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchProfiling>true</MtouchProfiling>
<IpaPackageName />
<MtouchI18n />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="MoviePlaybackSampleViewController.cs" />
<Compile Include="MoviePlaybackSampleViewController.designer.cs">
<DependentUpon>MoviePlaybackSampleViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="MoviePlaybackSampleViewController_iPhone.xib" />
<InterfaceDefinition Include="MoviePlaybackSampleViewController_iPad.xib" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="Images\" />
<Folder Include="Images\Icons\" />
<Folder Include="Movies\" />
</ItemGroup>
<ItemGroup>
<Content Include="Images\Icons\29_icon.png" />
<Content Include="Images\Icons\50_icon.png" />
<Content Include="Images\Icons\57_icon.png" />
<Content Include="Images\Icons\58_icon.png" />
<Content Include="Images\Icons\72_icon.png" />
<Content Include="Images\Icons\114_icon.png" />
<Content Include="Images\Icons\512_icon.png" />
<Content Include="Movies\file.m4v" />
<Content Include="Default.png" />
<Content Include="Default%402x.png" />
<Content Include="Default-Portrait.png" />
<Content Include="Default-Landscape.png" />
</ItemGroup>
</Project>
@@ -0,0 +1,76 @@
using MonoTouch.UIKit;
using System.Drawing;
using System;
using MonoTouch.Foundation;
using MonoTouch.MediaPlayer;

namespace MoviePlaybackSample
{
public partial class MoviePlaybackSampleViewController : UIViewController
{
//class level declarations
MPMoviePlayerController mp = new MPMoviePlayerController();

static bool UserInterfaceIdiomIsPhone {
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
}

public MoviePlaybackSampleViewController ()
: base (UserInterfaceIdiomIsPhone ? "MoviePlaybackSampleViewController_iPhone" : "MoviePlaybackSampleViewController_iPad", null)
{
}

public override void ViewDidLoad ()
{

base.ViewDidLoad ();

//Button Events
playMovieButton.TouchUpInside += delegate {

try{

//Set already instantiated MPMoviePlayerController to playback from Movies/file.m4v
mp = new MPMoviePlayerController (NSUrl.FromFilename("Movies/file.m4v"));

//enable AirPlay
mp.AllowsAirPlay = true;

//Add the MPMoviePlayerController View
this.View.AddSubview(mp.View);

//set the view to be full screen and show animated
mp.SetFullscreen(true, true);

//MPMoviePlayer must be set to PrepareToPlay before playback
mp.PrepareToPlay();

//Play Movie
mp.Play();

}catch{

Console.WriteLine("There was a problem playing back Video");

}

};

}

public override void ViewDidUnload ()
{
base.ViewDidUnload ();
}

public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
if (UserInterfaceIdiomIsPhone) {
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
} else {
return true;
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 30fb7b8

Please sign in to comment.