├── .gitignore ├── LICENSE ├── README.md ├── UniversalMediaEngine.sln ├── UniversalMediaEngine ├── MediaEngine.cpp ├── MediaEngine.h ├── MediaEngineManager.cpp ├── MediaEngineManager.h ├── MediaState.h ├── UniversalMediaEngine.vcxproj ├── UniversalMediaEngine.vcxproj.filters ├── pch.cpp └── pch.h └── samples ├── basicMediaEngineSample ├── basicMediaEngineSample.sln ├── basicMediaEngineSample │ ├── App.xaml │ ├── App.xaml.cpp │ ├── App.xaml.h │ ├── Assets │ │ ├── LockScreenLogo.scale-200.png │ │ ├── SplashScreen.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── StoreLogo.png │ │ └── Wide310x150Logo.scale-200.png │ ├── MainPage.xaml │ ├── MainPage.xaml.cpp │ ├── MainPage.xaml.h │ ├── Package.appxmanifest │ ├── basicMediaEngineSample.vcxproj │ ├── basicMediaEngineSample.vcxproj.filters │ ├── pch.cpp │ └── pch.h └── basicMediaEngineSampleCSharp │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Package.appxmanifest │ ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml │ ├── basicMediaEngineSampleCSharp.csproj │ ├── project.json │ └── project.lock.json └── speechSynthesisSample ├── speechSynthesisSample.sln └── speechSynthesisSample ├── App.xaml ├── App.xaml.cs ├── ApplicationInsights.config ├── Assets ├── LockScreenLogo.scale-200.png ├── SplashScreen.scale-200.png ├── Square150x150Logo.scale-200.png ├── Square44x44Logo.scale-200.png ├── Square44x44Logo.targetsize-24_altform-unplated.png ├── StoreLogo.png └── Wide310x150Logo.scale-200.png ├── MainPage.xaml ├── MainPage.xaml.cs ├── Package.appxmanifest ├── Properties ├── AssemblyInfo.cs └── Default.rd.xml ├── project.json └── speechSynthesisSample.csproj /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UniversalMediaEngine 2 | This is an IMFMediaEngine (Windows Media Foundation management class) wrapper that simplifies the playing of media 3 | in a Windows IoT Core headless applicaiton (since the XAML MediaElement is not avaliable to developers here). 4 | 5 | ##Usage: 6 | 7 | * Either build/add the Windows Runtime Component as a binary reference to your solution of add the UniversalMediaEngine project to your solution. 8 | * Initialize an instance of the MediaEngine object in your code like so: 9 | ``` 10 | this.mediaEngine = new MediaEngine(); 11 | var result = await this.mediaEngine.InitializeAsync(); 12 | if (result == MediaEngineInitializationResult.Fail) 13 | { 14 | // Your error logic 15 | } 16 | ``` 17 | * The MediaEngine object exposes Play (you pass a valid URL), Pause and Volume set/get as well as a callback that is fired when the state of media playback changes. 18 | 19 | *** 20 | 21 | This project has adopted the [Microsoft Open Source Code of Conduct](http://microsoft.github.io/codeofconduct). For more information see the [Code of Conduct FAQ](http://microsoft.github.io/codeofconduct/faq.md) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 22 | -------------------------------------------------------------------------------- /UniversalMediaEngine.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalMediaEngine", "UniversalMediaEngine\UniversalMediaEngine.vcxproj", "{81D46002-EC95-4423-BF6E-DBE82CCD55CA}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|ARM = Release|ARM 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|ARM.ActiveCfg = Debug|ARM 19 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|ARM.Build.0 = Debug|ARM 20 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x64.ActiveCfg = Debug|x64 21 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x64.Build.0 = Debug|x64 22 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x86.ActiveCfg = Debug|Win32 23 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x86.Build.0 = Debug|Win32 24 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|ARM.ActiveCfg = Release|ARM 25 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|ARM.Build.0 = Release|ARM 26 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x64.ActiveCfg = Release|x64 27 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x64.Build.0 = Release|x64 28 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x86.ActiveCfg = Release|Win32 29 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x86.Build.0 = Release|Win32 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /UniversalMediaEngine/MediaEngine.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "MediaEngineManager.h" 3 | #include "MediaEngine.h" 4 | 5 | using namespace Microsoft::Maker::Media::UniversalMediaEngine; 6 | using namespace Platform; 7 | using namespace concurrency; 8 | 9 | MediaEngine::~MediaEngine() 10 | { 11 | if (nullptr != spMediaEngineManager.Get()) 12 | { 13 | spMediaEngineManager->TearDown(); 14 | } 15 | } 16 | 17 | IAsyncOperation^ MediaEngine::InitializeAsync() 18 | { 19 | return create_async([this] 20 | { 21 | spMediaEngineManager = new MediaEngineManager(this); 22 | if (spMediaEngineManager.Get() != nullptr) 23 | { 24 | HRESULT hr = spMediaEngineManager->Initialize(); 25 | if (SUCCEEDED(hr)) 26 | { 27 | return MediaEngineInitializationResult::Success; 28 | } 29 | } 30 | 31 | return MediaEngineInitializationResult::Fail; 32 | }); 33 | } 34 | 35 | void MediaEngine::PlayStream(IRandomAccessStream^ stream) 36 | { 37 | HRESULT hr = E_FAIL; 38 | ComPtr spMFByteStream = nullptr; 39 | ComPtr pStreamUnk = reinterpret_cast(stream); 40 | 41 | CHR(MFCreateMFByteStreamOnStreamEx(pStreamUnk.Get(), &spMFByteStream)); 42 | CHR(spMediaEngineManager->PlayMfByteStream(spMFByteStream.Get())); 43 | 44 | End: 45 | 46 | if (S_OK != hr) 47 | throw ref new Exception(hr, "Invalid Stream"); 48 | 49 | return; 50 | } 51 | 52 | void MediaEngine::Play(Platform::String^ url) 53 | { 54 | HRESULT hr = E_FAIL; 55 | BSTR bstrUrl; 56 | 57 | bstrUrl = SysAllocString(url->Data()); 58 | 59 | hr = spMediaEngineManager->PlayUrl(bstrUrl); 60 | 61 | SysFreeString(bstrUrl); 62 | 63 | // Check the HR at the end so we know the string is freed before throw 64 | CHECK_INIT(hr); 65 | } 66 | 67 | void MediaEngine::Pause() 68 | { 69 | CHECK_INIT(spMediaEngineManager->Pause()); 70 | } 71 | 72 | void MediaEngine::Stop() 73 | { 74 | CHECK_INIT(spMediaEngineManager->Stop()); 75 | } 76 | 77 | double MediaEngine::Volume::get() 78 | { 79 | double volume; 80 | CHECK_INIT(spMediaEngineManager->GetVolume(&volume)); 81 | return volume; 82 | } 83 | 84 | void MediaEngine::Volume::set(double value) 85 | { 86 | CHECK_INIT(spMediaEngineManager->SetVolume(value)); 87 | } 88 | 89 | void MediaEngine::TriggerMediaStateChanged(MediaState state) 90 | { 91 | MediaStateChanged(state); 92 | } -------------------------------------------------------------------------------- /UniversalMediaEngine/MediaEngine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | using namespace Windows::Foundation; 4 | using namespace Windows::Storage::Streams; 5 | 6 | // Prototype 7 | class MediaEngineManager; 8 | 9 | namespace Microsoft { 10 | namespace Maker { 11 | namespace Media { 12 | namespace UniversalMediaEngine 13 | { 14 | public enum class MediaEngineInitializationResult 15 | { 16 | Success, 17 | Fail 18 | }; 19 | 20 | public delegate void MediaStateChangedHandler(MediaState state); 21 | 22 | public ref class MediaEngine sealed 23 | { 24 | private: 25 | ~MediaEngine(); 26 | public: 27 | 28 | /// 29 | /// Asynchronously initializes the media engine 30 | /// 31 | /// A task with a value that indicates whether Initialization was 32 | /// successful 33 | IAsyncOperation^ InitializeAsync(); 34 | 35 | /// 36 | /// Plays the media stream at the given URL 37 | /// 38 | void Play(Platform::String^ url); 39 | 40 | void PlayStream(IRandomAccessStream^ stream); 41 | 42 | /// 43 | /// Pauses playback 44 | /// 45 | void Pause(); 46 | 47 | /// 48 | /// Stops playback 49 | /// 50 | void Stop(); 51 | 52 | property double Volume 53 | { 54 | /// 55 | /// Gets the current volume 56 | /// 57 | /// The current volume 58 | double get(); 59 | 60 | /// 61 | /// Sets the current volume 62 | /// 63 | /// The new volume 64 | void set(double value); 65 | } 66 | 67 | /// 68 | /// Gets the current volume 69 | /// 70 | event MediaStateChangedHandler^ MediaStateChanged; 71 | 72 | internal: 73 | 74 | /// 75 | /// Used by internal components to trigger the MediaStateChanged event 76 | /// 77 | void TriggerMediaStateChanged(MediaState state); 78 | 79 | private: 80 | 81 | /// 82 | /// Used by internal components to trigger the MediaStateChanged event 83 | /// 84 | ComPtr spMediaEngineManager; 85 | }; 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /UniversalMediaEngine/MediaEngineManager.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "MediaEngine.h" 3 | #include "MediaEngineManager.h" 4 | 5 | using namespace Platform; 6 | using namespace Microsoft::Maker::Media::UniversalMediaEngine; 7 | 8 | MediaEngineManager::MediaEngineManager(MediaEngine^ mediaEngine) 9 | { 10 | mediaEngineComponent = mediaEngine; 11 | } 12 | 13 | HRESULT MediaEngineManager::QueryInterface(REFIID riid, 14 | LPVOID * ppvObj) 15 | { 16 | // Always set out parameter to NULL, validating it first. 17 | if (!ppvObj) 18 | return E_INVALIDARG; 19 | *ppvObj = NULL; 20 | if (riid == IID_IUnknown || riid == __uuidof(IMFMediaEngineNotify)) 21 | { 22 | // Increment the reference count and return the pointer. 23 | *ppvObj = (LPVOID)this; 24 | AddRef(); 25 | return NOERROR; 26 | } 27 | return E_NOINTERFACE; 28 | } 29 | 30 | ULONG MediaEngineManager::AddRef() 31 | { 32 | InterlockedIncrement(&m_cRef); 33 | return m_cRef; 34 | } 35 | ULONG MediaEngineManager::Release() 36 | { 37 | // Decrement the object's internal counter. 38 | ULONG ulRefCount = InterlockedDecrement(&m_cRef); 39 | if (0 == m_cRef) 40 | { 41 | delete this; 42 | } 43 | return ulRefCount; 44 | } 45 | 46 | HRESULT MediaEngineManager::Initialize() 47 | { 48 | HRESULT hr = E_FAIL; 49 | 50 | IMFMediaEngineClassFactory* mediaEngineFactory; 51 | IMFAttributes* mediaEngineAttributes; 52 | 53 | // If we are already initialized 54 | // then don't initialize again 55 | if (isInitialized) 56 | return S_FALSE; 57 | 58 | // Startup the media foundation subsystem 59 | CHR(MFStartup(MF_VERSION)); 60 | 61 | CHR(CoCreateInstance(CLSID_MFMediaEngineClassFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&mediaEngineFactory))); 62 | 63 | CHR(MFCreateAttributes(&mediaEngineAttributes, 1)); 64 | 65 | CHR(mediaEngineAttributes->SetUnknown(MF_MEDIA_ENGINE_CALLBACK, this)); 66 | 67 | // We only support audio since this component is designed for use in headless applications 68 | CHR(mediaEngineAttributes->SetUINT32(MF_MEDIA_ENGINE_AUDIO_CATEGORY, AUDIO_STREAM_CATEGORY::AudioCategory_Media)); 69 | 70 | auto flags = MF_MEDIA_ENGINE_AUDIOONLY | MF_MEDIA_ENGINE_REAL_TIME_MODE; 71 | 72 | CHR(mediaEngineFactory->CreateInstance(flags, mediaEngineAttributes, &spMediaEngine)); 73 | 74 | CHR(spMediaEngine->SetAutoPlay(true)); 75 | 76 | isInitialized = true; 77 | 78 | End: 79 | return hr; 80 | } 81 | 82 | HRESULT MediaEngineManager::TearDown() 83 | { 84 | HRESULT hr = E_FAIL; 85 | 86 | // If we are already initialized 87 | // then don't initialize again 88 | if (!isInitialized) 89 | return S_FALSE; 90 | 91 | // release the managers reference to the parent object 92 | mediaEngineComponent = nullptr; 93 | 94 | // Shutdown the media foundation subsystem 95 | CHR(MFShutdown()); 96 | 97 | isInitialized = false; 98 | 99 | End: 100 | return hr; 101 | } 102 | 103 | HRESULT MediaEngineManager::PlayUrl(BSTR url) 104 | { 105 | HRESULT hr = E_FAIL; 106 | CHR(checkInitialized()); 107 | 108 | CHR(spMediaEngine->SetSource(url)); 109 | CHR(spMediaEngine->Load()); 110 | 111 | End: 112 | return hr; 113 | } 114 | 115 | HRESULT MediaEngineManager::PlayMfByteStream(IMFByteStream* mfByteStream) 116 | { 117 | HRESULT hr = E_FAIL; 118 | BSTR url = nullptr; 119 | ComPtr spMediaEngineEx = nullptr; 120 | 121 | CHR(spMediaEngine.As(&spMediaEngineEx)); 122 | url = SysAllocString(L"file://"); 123 | CHR(spMediaEngineEx->SetSourceFromByteStream(mfByteStream, url)); 124 | CHR(spMediaEngineEx->Play()); 125 | 126 | End: 127 | if (nullptr != url) 128 | SysFreeString(url); 129 | 130 | return hr; 131 | } 132 | 133 | HRESULT MediaEngineManager::Pause() 134 | { 135 | HRESULT hr = E_FAIL; 136 | CHR(checkInitialized()); 137 | 138 | CHR(spMediaEngine->Pause()); 139 | 140 | End: 141 | return hr; 142 | } 143 | 144 | HRESULT MediaEngineManager::Stop() 145 | { 146 | HRESULT hr = E_FAIL; 147 | CHR(checkInitialized()); 148 | 149 | CHR(spMediaEngine->Shutdown()); 150 | 151 | End: 152 | return hr; 153 | } 154 | 155 | HRESULT MediaEngineManager::GetVolume(double* pVolume) 156 | { 157 | HRESULT hr = E_FAIL; 158 | CHR(checkInitialized()); 159 | 160 | CP(pVolume); 161 | 162 | *pVolume = spMediaEngine->GetVolume(); 163 | 164 | End: 165 | return hr; 166 | } 167 | 168 | HRESULT MediaEngineManager::SetVolume(double volume) 169 | { 170 | HRESULT hr = E_FAIL; 171 | CHR(checkInitialized()); 172 | 173 | CHR(spMediaEngine->SetVolume(volume)); 174 | 175 | End: 176 | return hr; 177 | } 178 | 179 | HRESULT MediaEngineManager::EventNotify(DWORD event, DWORD_PTR param1, DWORD param2) 180 | { 181 | switch (event) 182 | { 183 | case MF_MEDIA_ENGINE_EVENT_LOADSTART: 184 | mediaEngineComponent->TriggerMediaStateChanged(MediaState::Loading); 185 | break; 186 | case MF_MEDIA_ENGINE_EVENT_PLAYING: 187 | mediaEngineComponent->TriggerMediaStateChanged(MediaState::Playing); 188 | break; 189 | case MF_MEDIA_ENGINE_EVENT_ENDED: 190 | mediaEngineComponent->TriggerMediaStateChanged(MediaState::Ended); 191 | break; 192 | case MF_MEDIA_ENGINE_EVENT_ERROR: 193 | mediaEngineComponent->TriggerMediaStateChanged(MediaState::Error); 194 | break; 195 | } 196 | 197 | return S_OK; 198 | } 199 | 200 | HRESULT MediaEngineManager::checkInitialized() 201 | { 202 | if (isInitialized) 203 | { 204 | return S_OK; 205 | } 206 | else 207 | { 208 | return E_NOT_VALID_STATE; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /UniversalMediaEngine/MediaEngineManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | using namespace Windows::Storage::Streams; 4 | 5 | namespace Microsoft { 6 | namespace Maker { 7 | namespace Media { 8 | namespace UniversalMediaEngine 9 | { 10 | partial ref class MediaEngine; 11 | } 12 | } 13 | } 14 | } 15 | 16 | class MediaEngineNotify; 17 | 18 | class MediaEngineManager : public IMFMediaEngineNotify 19 | { 20 | public: 21 | MediaEngineManager(Microsoft::Maker::Media::UniversalMediaEngine::MediaEngine^ mediaEngine); 22 | 23 | HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, 24 | LPVOID * ppvObj); 25 | 26 | ULONG STDMETHODCALLTYPE AddRef(); 27 | 28 | ULONG STDMETHODCALLTYPE Release(); 29 | 30 | HRESULT Initialize(); 31 | HRESULT TearDown(); 32 | 33 | HRESULT PlayUrl(BSTR url); 34 | 35 | HRESULT PlayMfByteStream(IMFByteStream* mfByteStream); 36 | 37 | HRESULT Pause(); 38 | 39 | HRESULT Stop(); 40 | 41 | HRESULT GetVolume(double* pVolume); 42 | HRESULT SetVolume(double volume); 43 | 44 | HRESULT STDMETHODCALLTYPE EventNotify( 45 | DWORD event, 46 | DWORD_PTR param1, 47 | DWORD param2 48 | ); 49 | 50 | private: 51 | LONG m_cRef; 52 | bool isInitialized; 53 | ComPtr spMediaEngine; 54 | Microsoft::Maker::Media::UniversalMediaEngine::MediaEngine^ mediaEngineComponent; 55 | 56 | HRESULT checkInitialized(); 57 | }; 58 | 59 | 60 | -------------------------------------------------------------------------------- /UniversalMediaEngine/MediaState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Microsoft { 4 | namespace Maker { 5 | namespace Media { 6 | namespace UniversalMediaEngine 7 | { 8 | public enum class MediaState 9 | { 10 | Error, 11 | Ended, 12 | Stopped, 13 | Loading, 14 | Playing, 15 | }; 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /UniversalMediaEngine/UniversalMediaEngine.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | ARM 7 | 8 | 9 | Debug 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | ARM 19 | 20 | 21 | Release 22 | Win32 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | 30 | {81d46002-ec95-4423-bf6e-dbe82ccd55ca} 31 | WindowsRuntimeComponent 32 | UniversalMediaEngine 33 | Microsoft.Maker.Media.UniversalMediaEngine 34 | en-US 35 | 14.0 36 | true 37 | Windows Store 38 | 10.0.10240.0 39 | 10.0.10240.0 40 | 10.0 41 | 42 | 43 | 44 | DynamicLibrary 45 | true 46 | v140 47 | 48 | 49 | DynamicLibrary 50 | true 51 | v141 52 | 53 | 54 | DynamicLibrary 55 | true 56 | v140 57 | 58 | 59 | DynamicLibrary 60 | false 61 | true 62 | v140 63 | 64 | 65 | DynamicLibrary 66 | false 67 | true 68 | v140 69 | 70 | 71 | DynamicLibrary 72 | false 73 | true 74 | v140 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | false 103 | 104 | 105 | false 106 | 107 | 108 | false 109 | 110 | 111 | false 112 | 113 | 114 | false 115 | 116 | 117 | false 118 | 119 | 120 | 121 | Use 122 | _WINRT_DLL;%(PreprocessorDefinitions) 123 | pch.h 124 | $(IntDir)pch.pch 125 | $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) 126 | /bigobj %(AdditionalOptions) 127 | 28204 128 | 129 | 130 | Console 131 | false 132 | 133 | 134 | 135 | 136 | Use 137 | _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) 138 | pch.h 139 | $(IntDir)pch.pch 140 | $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) 141 | /bigobj %(AdditionalOptions) 142 | 28204 143 | 144 | 145 | Console 146 | false 147 | 148 | 149 | 150 | 151 | Use 152 | _WINRT_DLL;%(PreprocessorDefinitions) 153 | pch.h 154 | $(IntDir)pch.pch 155 | $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) 156 | /bigobj %(AdditionalOptions) 157 | 28204 158 | 159 | 160 | Console 161 | false 162 | 163 | 164 | 165 | 166 | Use 167 | _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) 168 | pch.h 169 | $(IntDir)pch.pch 170 | $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) 171 | /bigobj %(AdditionalOptions) 172 | 28204 173 | 174 | 175 | Console 176 | false 177 | 178 | 179 | 180 | 181 | Use 182 | _WINRT_DLL;%(PreprocessorDefinitions) 183 | pch.h 184 | $(IntDir)pch.pch 185 | $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) 186 | /bigobj %(AdditionalOptions) 187 | 28204 188 | 189 | 190 | Console 191 | false 192 | 193 | 194 | 195 | 196 | Use 197 | _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) 198 | pch.h 199 | $(IntDir)pch.pch 200 | $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) 201 | /bigobj %(AdditionalOptions) 202 | 28204 203 | 204 | 205 | Console 206 | false 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | Create 219 | Create 220 | Create 221 | Create 222 | Create 223 | Create 224 | 225 | 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /UniversalMediaEngine/UniversalMediaEngine.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 0c38429e-473e-4e68-9876-ce7cd9ec7978 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /UniversalMediaEngine/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /UniversalMediaEngine/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "MediaState.h" 14 | 15 | using namespace Microsoft::WRL; 16 | 17 | #define CHECK_INIT(hr) if (E_NOT_VALID_STATE == hr) { throw ref new Exception(hr, "Media Engine initialization must have completed before subsequent operations can be performed");} 18 | #define CHR(chr) hr = chr; if (FAILED(hr)) { goto End;} 19 | #define CP(pointer) if ((void*)pointer == nullptr) {hr = E_INVALIDARG; goto End;} -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basicMediaEngineSample", "basicMediaEngineSample\basicMediaEngineSample.vcxproj", "{AA0EC075-7BA0-49D9-A85D-02BF68699B30}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalMediaEngine", "..\..\UniversalMediaEngine\UniversalMediaEngine.vcxproj", "{81D46002-EC95-4423-BF6E-DBE82CCD55CA}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "basicMediaEngineSampleCSharp", "basicMediaEngineSampleCSharp\basicMediaEngineSampleCSharp.csproj", "{A7DF83F0-C113-47F3-95DA-B2BC5C118F48}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|ARM = Debug|ARM 15 | Debug|x64 = Debug|x64 16 | Debug|x86 = Debug|x86 17 | Release|ARM = Release|ARM 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|ARM.ActiveCfg = Debug|ARM 23 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|ARM.Build.0 = Debug|ARM 24 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|ARM.Deploy.0 = Debug|ARM 25 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|x64.ActiveCfg = Debug|x64 26 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|x64.Build.0 = Debug|x64 27 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|x64.Deploy.0 = Debug|x64 28 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|x86.ActiveCfg = Debug|Win32 29 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|x86.Build.0 = Debug|Win32 30 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Debug|x86.Deploy.0 = Debug|Win32 31 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|ARM.ActiveCfg = Release|ARM 32 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|ARM.Build.0 = Release|ARM 33 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|ARM.Deploy.0 = Release|ARM 34 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|x64.ActiveCfg = Release|x64 35 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|x64.Build.0 = Release|x64 36 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|x64.Deploy.0 = Release|x64 37 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|x86.ActiveCfg = Release|Win32 38 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|x86.Build.0 = Release|Win32 39 | {AA0EC075-7BA0-49D9-A85D-02BF68699B30}.Release|x86.Deploy.0 = Release|Win32 40 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|ARM.ActiveCfg = Debug|ARM 41 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|ARM.Build.0 = Debug|ARM 42 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x64.ActiveCfg = Debug|x64 43 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x64.Build.0 = Debug|x64 44 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x86.ActiveCfg = Debug|Win32 45 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x86.Build.0 = Debug|Win32 46 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|ARM.ActiveCfg = Release|ARM 47 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|ARM.Build.0 = Release|ARM 48 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x64.ActiveCfg = Release|x64 49 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x64.Build.0 = Release|x64 50 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x86.ActiveCfg = Release|Win32 51 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x86.Build.0 = Release|Win32 52 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|ARM.ActiveCfg = Debug|ARM 53 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|ARM.Build.0 = Debug|ARM 54 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|ARM.Deploy.0 = Debug|ARM 55 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|x64.ActiveCfg = Debug|x64 56 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|x64.Build.0 = Debug|x64 57 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|x64.Deploy.0 = Debug|x64 58 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|x86.ActiveCfg = Debug|x86 59 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|x86.Build.0 = Debug|x86 60 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Debug|x86.Deploy.0 = Debug|x86 61 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|ARM.ActiveCfg = Release|ARM 62 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|ARM.Build.0 = Release|ARM 63 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|ARM.Deploy.0 = Release|ARM 64 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|x64.ActiveCfg = Release|x64 65 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|x64.Build.0 = Release|x64 66 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|x64.Deploy.0 = Release|x64 67 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|x86.ActiveCfg = Release|x86 68 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|x86.Build.0 = Release|x86 69 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48}.Release|x86.Deploy.0 = Release|x86 70 | EndGlobalSection 71 | GlobalSection(SolutionProperties) = preSolution 72 | HideSolutionNode = FALSE 73 | EndGlobalSection 74 | EndGlobal 75 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/App.xaml.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // App.xaml.cpp 3 | // Implementation of the App class. 4 | // 5 | 6 | #include "pch.h" 7 | #include "MainPage.xaml.h" 8 | 9 | using namespace basicMediaEngineSample; 10 | 11 | using namespace Platform; 12 | using namespace Windows::ApplicationModel; 13 | using namespace Windows::ApplicationModel::Activation; 14 | using namespace Windows::Foundation; 15 | using namespace Windows::Foundation::Collections; 16 | using namespace Windows::UI::Xaml; 17 | using namespace Windows::UI::Xaml::Controls; 18 | using namespace Windows::UI::Xaml::Controls::Primitives; 19 | using namespace Windows::UI::Xaml::Data; 20 | using namespace Windows::UI::Xaml::Input; 21 | using namespace Windows::UI::Xaml::Interop; 22 | using namespace Windows::UI::Xaml::Media; 23 | using namespace Windows::UI::Xaml::Navigation; 24 | 25 | /// 26 | /// Initializes the singleton application object. This is the first line of authored code 27 | /// executed, and as such is the logical equivalent of main() or WinMain(). 28 | /// 29 | App::App() 30 | { 31 | InitializeComponent(); 32 | Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); 33 | } 34 | 35 | /// 36 | /// Invoked when the application is launched normally by the end user. Other entry points 37 | /// will be used such as when the application is launched to open a specific file. 38 | /// 39 | /// Details about the launch request and process. 40 | void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) 41 | { 42 | 43 | #if _DEBUG 44 | // Show graphics profiling information while debugging. 45 | if (IsDebuggerPresent()) 46 | { 47 | // Display the current frame rate counters 48 | DebugSettings->EnableFrameRateCounter = true; 49 | } 50 | #endif 51 | 52 | auto rootFrame = dynamic_cast(Window::Current->Content); 53 | 54 | // Do not repeat app initialization when the Window already has content, 55 | // just ensure that the window is active 56 | if (rootFrame == nullptr) 57 | { 58 | // Create a Frame to act as the navigation context and associate it with 59 | // a SuspensionManager key 60 | rootFrame = ref new Frame(); 61 | 62 | rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); 63 | 64 | if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) 65 | { 66 | // TODO: Restore the saved session state only when appropriate, scheduling the 67 | // final launch steps after the restore is complete 68 | 69 | } 70 | 71 | if (rootFrame->Content == nullptr) 72 | { 73 | // When the navigation stack isn't restored navigate to the first page, 74 | // configuring the new page by passing required information as a navigation 75 | // parameter 76 | rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); 77 | } 78 | // Place the frame in the current Window 79 | Window::Current->Content = rootFrame; 80 | // Ensure the current window is active 81 | Window::Current->Activate(); 82 | } 83 | else 84 | { 85 | if (rootFrame->Content == nullptr) 86 | { 87 | // When the navigation stack isn't restored navigate to the first page, 88 | // configuring the new page by passing required information as a navigation 89 | // parameter 90 | rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); 91 | } 92 | // Ensure the current window is active 93 | Window::Current->Activate(); 94 | } 95 | } 96 | 97 | /// 98 | /// Invoked when application execution is being suspended. Application state is saved 99 | /// without knowing whether the application will be terminated or resumed with the contents 100 | /// of memory still intact. 101 | /// 102 | /// The source of the suspend request. 103 | /// Details about the suspend request. 104 | void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) 105 | { 106 | (void) sender; // Unused parameter 107 | (void) e; // Unused parameter 108 | 109 | //TODO: Save application state and stop any background activity 110 | } 111 | 112 | /// 113 | /// Invoked when Navigation to a certain page fails 114 | /// 115 | /// The Frame which failed navigation 116 | /// Details about the navigation failure 117 | void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) 118 | { 119 | throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); 120 | } -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/App.xaml.h: -------------------------------------------------------------------------------- 1 | // 2 | // App.xaml.h 3 | // Declaration of the App class. 4 | // 5 | 6 | #pragma once 7 | 8 | #include "App.g.h" 9 | 10 | namespace basicMediaEngineSample 11 | { 12 | /// 13 | /// Provides application-specific behavior to supplement the default Application class. 14 | /// 15 | ref class App sealed 16 | { 17 | protected: 18 | virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; 19 | 20 | internal: 21 | App(); 22 | 23 | private: 24 | void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); 25 | void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSample/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSample/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSample/Assets/StoreLogo.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSample/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | UniversalMediaEngine 13 | 14 | 15 | Current Status: 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/MainPage.xaml.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // MainPage.xaml.cpp 3 | // Implementation of the MainPage class. 4 | // 5 | 6 | #include "pch.h" 7 | #include "MainPage.xaml.h" 8 | 9 | using namespace basicMediaEngineSample; 10 | 11 | using namespace Platform; 12 | using namespace Windows::Foundation; 13 | using namespace Windows::Foundation::Collections; 14 | using namespace Windows::UI::Xaml; 15 | using namespace Windows::UI::Xaml::Controls; 16 | using namespace Windows::UI::Xaml::Controls::Primitives; 17 | using namespace Windows::UI::Xaml::Data; 18 | using namespace Windows::UI::Xaml::Input; 19 | using namespace Windows::UI::Xaml::Media; 20 | using namespace Windows::UI::Xaml::Navigation; 21 | using namespace Windows::UI::Core; 22 | 23 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 24 | 25 | MainPage::MainPage() 26 | { 27 | InitializeComponent(); 28 | } 29 | 30 | 31 | void basicMediaEngineSample::MainPage::Page_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) 32 | { 33 | m_mediaEngine.MediaStateChanged += ref new MediaStateChangedHandler(this, &basicMediaEngineSample::MainPage::OnMediaStateChanged); 34 | m_mediaEngine.InitializeAsync(); 35 | } 36 | 37 | 38 | void basicMediaEngineSample::MainPage::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) 39 | { 40 | m_mediaEngine.Play(UrlBox->Text); 41 | } 42 | 43 | 44 | void basicMediaEngineSample::MainPage::OnMediaStateChanged(MediaState state) 45 | { 46 | Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler( 47 | [=]() 48 | { 49 | CurrentStatus->Text = state.ToString(); 50 | })); 51 | 52 | } 53 | 54 | 55 | void basicMediaEngineSample::MainPage::Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) 56 | { 57 | m_mediaEngine.Pause(); 58 | } 59 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/MainPage.xaml.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainPage.xaml.h 3 | // Declaration of the MainPage class. 4 | // 5 | 6 | #pragma once 7 | 8 | #include "MainPage.g.h" 9 | 10 | using namespace Microsoft::Maker::Media::UniversalMediaEngine; 11 | 12 | namespace basicMediaEngineSample 13 | { 14 | /// 15 | /// An empty page that can be used on its own or navigated to within a Frame. 16 | /// 17 | public ref class MainPage sealed 18 | { 19 | public: 20 | MainPage(); 21 | 22 | private: 23 | MediaEngine m_mediaEngine; 24 | 25 | void Page_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); 26 | void Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); 27 | void OnMediaStateChanged(MediaState state); 28 | void Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | basicMediaEngineSample 18 | Microsoft Corporation 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/basicMediaEngineSample.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | {aa0ec075-7ba0-49d9-a85d-02bf68699b30} 5 | basicMediaEngineSample 6 | en-US 7 | 14.0 8 | true 9 | Windows Store 10 | 10.0.10240.0 11 | 10.0.10240.0 12 | 10.0 13 | true 14 | 15 | 16 | 17 | 18 | Debug 19 | ARM 20 | 21 | 22 | Debug 23 | Win32 24 | 25 | 26 | Debug 27 | x64 28 | 29 | 30 | Release 31 | ARM 32 | 33 | 34 | Release 35 | Win32 36 | 37 | 38 | Release 39 | x64 40 | 41 | 42 | 43 | Application 44 | true 45 | v140 46 | 47 | 48 | Application 49 | true 50 | v140 51 | 52 | 53 | Application 54 | true 55 | v140 56 | 57 | 58 | Application 59 | false 60 | true 61 | v140 62 | true 63 | 64 | 65 | Application 66 | false 67 | true 68 | v140 69 | true 70 | 71 | 72 | Application 73 | false 74 | true 75 | v140 76 | true 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | basicMediaEngineSample_TemporaryKey.pfx 102 | 103 | 104 | 105 | /bigobj %(AdditionalOptions) 106 | 4453;28204 107 | 108 | 109 | 110 | 111 | /bigobj %(AdditionalOptions) 112 | 4453;28204 113 | 114 | 115 | 116 | 117 | /bigobj %(AdditionalOptions) 118 | 4453;28204 119 | 120 | 121 | 122 | 123 | /bigobj %(AdditionalOptions) 124 | 4453;28204 125 | 126 | 127 | 128 | 129 | /bigobj %(AdditionalOptions) 130 | 4453;28204 131 | 132 | 133 | 134 | 135 | /bigobj %(AdditionalOptions) 136 | 4453;28204 137 | 138 | 139 | 140 | 141 | 142 | App.xaml 143 | 144 | 145 | MainPage.xaml 146 | 147 | 148 | 149 | 150 | Designer 151 | 152 | 153 | Designer 154 | 155 | 156 | 157 | 158 | Designer 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | App.xaml 174 | 175 | 176 | MainPage.xaml 177 | 178 | 179 | Create 180 | Create 181 | Create 182 | Create 183 | Create 184 | Create 185 | 186 | 187 | 188 | 189 | {81d46002-ec95-4423-bf6e-dbe82ccd55ca} 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/basicMediaEngineSample.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | aa0ec075-7ba0-49d9-a85d-02bf68699b30 6 | 7 | 8 | a544e918-bc0b-46a5-a4d3-6cd6c54c908b 9 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Assets 28 | 29 | 30 | Assets 31 | 32 | 33 | Assets 34 | 35 | 36 | Assets 37 | 38 | 39 | Assets 40 | 41 | 42 | Assets 43 | 44 | 45 | Assets 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/pch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pch.cpp 3 | // Include the standard header and generate the precompiled header. 4 | // 5 | 6 | #include "pch.h" 7 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSample/pch.h: -------------------------------------------------------------------------------- 1 | // 2 | // pch.h 3 | // Header for standard system include files. 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | #include "App.xaml.h" 12 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.ApplicationModel; 7 | using Windows.ApplicationModel.Activation; 8 | using Windows.Foundation; 9 | using Windows.Foundation.Collections; 10 | using Windows.UI.Xaml; 11 | using Windows.UI.Xaml.Controls; 12 | using Windows.UI.Xaml.Controls.Primitives; 13 | using Windows.UI.Xaml.Data; 14 | using Windows.UI.Xaml.Input; 15 | using Windows.UI.Xaml.Media; 16 | using Windows.UI.Xaml.Navigation; 17 | 18 | namespace basicMediaEngineSampleCSharp 19 | { 20 | /// 21 | /// Provides application-specific behavior to supplement the default Application class. 22 | /// 23 | sealed partial class App : Application 24 | { 25 | /// 26 | /// Initializes the singleton application object. This is the first line of authored code 27 | /// executed, and as such is the logical equivalent of main() or WinMain(). 28 | /// 29 | public App() 30 | { 31 | this.InitializeComponent(); 32 | this.Suspending += OnSuspending; 33 | } 34 | 35 | /// 36 | /// Invoked when the application is launched normally by the end user. Other entry points 37 | /// will be used such as when the application is launched to open a specific file. 38 | /// 39 | /// Details about the launch request and process. 40 | protected override void OnLaunched(LaunchActivatedEventArgs e) 41 | { 42 | 43 | #if DEBUG 44 | if (System.Diagnostics.Debugger.IsAttached) 45 | { 46 | this.DebugSettings.EnableFrameRateCounter = true; 47 | } 48 | #endif 49 | 50 | Frame rootFrame = Window.Current.Content as Frame; 51 | 52 | // Do not repeat app initialization when the Window already has content, 53 | // just ensure that the window is active 54 | if (rootFrame == null) 55 | { 56 | // Create a Frame to act as the navigation context and navigate to the first page 57 | rootFrame = new Frame(); 58 | 59 | rootFrame.NavigationFailed += OnNavigationFailed; 60 | 61 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 62 | { 63 | //TODO: Load state from previously suspended application 64 | } 65 | 66 | // Place the frame in the current Window 67 | Window.Current.Content = rootFrame; 68 | } 69 | 70 | if (rootFrame.Content == null) 71 | { 72 | // When the navigation stack isn't restored navigate to the first page, 73 | // configuring the new page by passing required information as a navigation 74 | // parameter 75 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 76 | } 77 | // Ensure the current window is active 78 | Window.Current.Activate(); 79 | } 80 | 81 | /// 82 | /// Invoked when Navigation to a certain page fails 83 | /// 84 | /// The Frame which failed navigation 85 | /// Details about the navigation failure 86 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 87 | { 88 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 89 | } 90 | 91 | /// 92 | /// Invoked when application execution is being suspended. Application state is saved 93 | /// without knowing whether the application will be terminated or resumed with the contents 94 | /// of memory still intact. 95 | /// 96 | /// The source of the suspend request. 97 | /// Details about the suspend request. 98 | private void OnSuspending(object sender, SuspendingEventArgs e) 99 | { 100 | var deferral = e.SuspendingOperation.GetDeferral(); 101 | //TODO: Save application state and stop any background activity 102 | deferral.Complete(); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/StoreLogo.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | UniversalMediaEngine 13 | 14 | 15 | Current Status: 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | using Microsoft.Maker.Media.UniversalMediaEngine; 16 | using Windows.UI.Core; 17 | 18 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 19 | 20 | namespace basicMediaEngineSampleCSharp 21 | { 22 | /// 23 | /// An empty page that can be used on its own or navigated to within a Frame. 24 | /// 25 | public sealed partial class MainPage : Page 26 | { 27 | private MediaEngine m_mediaEngine = new MediaEngine(); 28 | 29 | public MainPage() 30 | { 31 | this.InitializeComponent(); 32 | } 33 | 34 | private async void Page_Loaded(object sender, RoutedEventArgs e) 35 | { 36 | m_mediaEngine.MediaStateChanged += OnMediaStateChanged; 37 | await m_mediaEngine.InitializeAsync(); 38 | } 39 | 40 | private async void OnMediaStateChanged(MediaState state) 41 | { 42 | await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => CurrentStatus.Text = state.ToString()); 43 | } 44 | 45 | private void Button_Click(object sender, RoutedEventArgs e) 46 | { 47 | m_mediaEngine.Play(UrlBox.Text); 48 | } 49 | 50 | private void Button_Click_1(object sender, RoutedEventArgs e) 51 | { 52 | m_mediaEngine.Pause(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | basicMediaEngineSampleCSharp 18 | Paul 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("basicMediaEngineSampleCSharp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("basicMediaEngineSampleCSharp")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/basicMediaEngineSampleCSharp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x86 7 | {A7DF83F0-C113-47F3-95DA-B2BC5C118F48} 8 | AppContainerExe 9 | Properties 10 | basicMediaEngineSampleCSharp 11 | basicMediaEngineSampleCSharp 12 | en-US 13 | UAP 14 | 10.0.10586.0 15 | 10.0.10240.0 16 | 14 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | basicMediaEngineSampleCSharp_TemporaryKey.pfx 20 | 21 | 22 | true 23 | bin\x86\Debug\ 24 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 25 | ;2008 26 | full 27 | x86 28 | false 29 | prompt 30 | true 31 | 32 | 33 | bin\x86\Release\ 34 | TRACE;NETFX_CORE;WINDOWS_UWP 35 | true 36 | ;2008 37 | pdbonly 38 | x86 39 | false 40 | prompt 41 | true 42 | true 43 | 44 | 45 | true 46 | bin\ARM\Debug\ 47 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 48 | ;2008 49 | full 50 | ARM 51 | false 52 | prompt 53 | true 54 | 55 | 56 | bin\ARM\Release\ 57 | TRACE;NETFX_CORE;WINDOWS_UWP 58 | true 59 | ;2008 60 | pdbonly 61 | ARM 62 | false 63 | prompt 64 | true 65 | true 66 | 67 | 68 | true 69 | bin\x64\Debug\ 70 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 71 | ;2008 72 | full 73 | x64 74 | false 75 | prompt 76 | true 77 | 78 | 79 | bin\x64\Release\ 80 | TRACE;NETFX_CORE;WINDOWS_UWP 81 | true 82 | ;2008 83 | pdbonly 84 | x64 85 | false 86 | prompt 87 | true 88 | true 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | App.xaml 97 | 98 | 99 | MainPage.xaml 100 | 101 | 102 | 103 | 104 | 105 | Designer 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | MSBuild:Compile 122 | Designer 123 | 124 | 125 | MSBuild:Compile 126 | Designer 127 | 128 | 129 | 130 | 131 | {81d46002-ec95-4423-bf6e-dbe82ccd55ca} 132 | UniversalMediaEngine 133 | 134 | 135 | 136 | 14.0 137 | 138 | 139 | 146 | -------------------------------------------------------------------------------- /samples/basicMediaEngineSample/basicMediaEngineSampleCSharp/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" 4 | }, 5 | "frameworks": { 6 | "uap10.0": {} 7 | }, 8 | "runtimes": { 9 | "win10-arm": {}, 10 | "win10-arm-aot": {}, 11 | "win10-x86": {}, 12 | "win10-x86-aot": {}, 13 | "win10-x64": {}, 14 | "win10-x64-aot": {} 15 | } 16 | } -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24630.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "speechSynthesisSample", "speechSynthesisSample\speechSynthesisSample.csproj", "{B53E30B4-BA67-4C66-979D-A000667FA248}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalMediaEngine", "..\..\UniversalMediaEngine\UniversalMediaEngine.vcxproj", "{81D46002-EC95-4423-BF6E-DBE82CCD55CA}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|ARM = Debug|ARM 13 | Debug|x64 = Debug|x64 14 | Debug|x86 = Debug|x86 15 | Release|ARM = Release|ARM 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|ARM.ActiveCfg = Debug|ARM 21 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|ARM.Build.0 = Debug|ARM 22 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|ARM.Deploy.0 = Debug|ARM 23 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|x64.ActiveCfg = Debug|x64 24 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|x64.Build.0 = Debug|x64 25 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|x64.Deploy.0 = Debug|x64 26 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|x86.ActiveCfg = Debug|x86 27 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|x86.Build.0 = Debug|x86 28 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Debug|x86.Deploy.0 = Debug|x86 29 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|ARM.ActiveCfg = Release|ARM 30 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|ARM.Build.0 = Release|ARM 31 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|ARM.Deploy.0 = Release|ARM 32 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|x64.ActiveCfg = Release|x64 33 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|x64.Build.0 = Release|x64 34 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|x64.Deploy.0 = Release|x64 35 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|x86.ActiveCfg = Release|x86 36 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|x86.Build.0 = Release|x86 37 | {B53E30B4-BA67-4C66-979D-A000667FA248}.Release|x86.Deploy.0 = Release|x86 38 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|ARM.ActiveCfg = Debug|ARM 39 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|ARM.Build.0 = Debug|ARM 40 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x64.ActiveCfg = Debug|x64 41 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x64.Build.0 = Debug|x64 42 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x86.ActiveCfg = Debug|Win32 43 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Debug|x86.Build.0 = Debug|Win32 44 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|ARM.ActiveCfg = Release|ARM 45 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|ARM.Build.0 = Release|ARM 46 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x64.ActiveCfg = Release|x64 47 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x64.Build.0 = Release|x64 48 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x86.ActiveCfg = Release|Win32 49 | {81D46002-EC95-4423-BF6E-DBE82CCD55CA}.Release|x86.Build.0 = Release|Win32 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | EndGlobal 55 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.ApplicationModel; 7 | using Windows.ApplicationModel.Activation; 8 | using Windows.Foundation; 9 | using Windows.Foundation.Collections; 10 | using Windows.UI.Xaml; 11 | using Windows.UI.Xaml.Controls; 12 | using Windows.UI.Xaml.Controls.Primitives; 13 | using Windows.UI.Xaml.Data; 14 | using Windows.UI.Xaml.Input; 15 | using Windows.UI.Xaml.Media; 16 | using Windows.UI.Xaml.Navigation; 17 | 18 | namespace speechSynthesisSample 19 | { 20 | /// 21 | /// Provides application-specific behavior to supplement the default Application class. 22 | /// 23 | sealed partial class App : Application 24 | { 25 | /// 26 | /// Initializes the singleton application object. This is the first line of authored code 27 | /// executed, and as such is the logical equivalent of main() or WinMain(). 28 | /// 29 | public App() 30 | { 31 | Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( 32 | Microsoft.ApplicationInsights.WindowsCollectors.Metadata | 33 | Microsoft.ApplicationInsights.WindowsCollectors.Session); 34 | this.InitializeComponent(); 35 | this.Suspending += OnSuspending; 36 | } 37 | 38 | /// 39 | /// Invoked when the application is launched normally by the end user. Other entry points 40 | /// will be used such as when the application is launched to open a specific file. 41 | /// 42 | /// Details about the launch request and process. 43 | protected override void OnLaunched(LaunchActivatedEventArgs e) 44 | { 45 | 46 | #if DEBUG 47 | if (System.Diagnostics.Debugger.IsAttached) 48 | { 49 | this.DebugSettings.EnableFrameRateCounter = true; 50 | } 51 | #endif 52 | 53 | Frame rootFrame = Window.Current.Content as Frame; 54 | 55 | // Do not repeat app initialization when the Window already has content, 56 | // just ensure that the window is active 57 | if (rootFrame == null) 58 | { 59 | // Create a Frame to act as the navigation context and navigate to the first page 60 | rootFrame = new Frame(); 61 | 62 | rootFrame.NavigationFailed += OnNavigationFailed; 63 | 64 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 65 | { 66 | //TODO: Load state from previously suspended application 67 | } 68 | 69 | // Place the frame in the current Window 70 | Window.Current.Content = rootFrame; 71 | } 72 | 73 | if (rootFrame.Content == null) 74 | { 75 | // When the navigation stack isn't restored navigate to the first page, 76 | // configuring the new page by passing required information as a navigation 77 | // parameter 78 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 79 | } 80 | // Ensure the current window is active 81 | Window.Current.Activate(); 82 | } 83 | 84 | /// 85 | /// Invoked when Navigation to a certain page fails 86 | /// 87 | /// The Frame which failed navigation 88 | /// Details about the navigation failure 89 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 90 | { 91 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 92 | } 93 | 94 | /// 95 | /// Invoked when application execution is being suspended. Application state is saved 96 | /// without knowing whether the application will be terminated or resumed with the contents 97 | /// of memory still intact. 98 | /// 99 | /// The source of the suspend request. 100 | /// Details about the suspend request. 101 | private void OnSuspending(object sender, SuspendingEventArgs e) 102 | { 103 | var deferral = e.SuspendingOperation.GetDeferral(); 104 | //TODO: Save application state and stop any background activity 105 | deferral.Complete(); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/ApplicationInsights.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/speechSynthesisSample/speechSynthesisSample/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/speechSynthesisSample/speechSynthesisSample/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/speechSynthesisSample/speechSynthesisSample/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/speechSynthesisSample/speechSynthesisSample/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/speechSynthesisSample/speechSynthesisSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/speechSynthesisSample/speechSynthesisSample/Assets/StoreLogo.png -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/UniversalMediaEngine/b9d2e00abb5a7119d86bd0179312a50b222d1aae/samples/speechSynthesisSample/speechSynthesisSample/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 |  2 | using Microsoft.Maker.Media.UniversalMediaEngine; 3 | using System; 4 | using System.Diagnostics; 5 | using Windows.Media.SpeechSynthesis; 6 | using Windows.UI.Xaml; 7 | using Windows.UI.Xaml.Controls; 8 | 9 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 10 | 11 | namespace speechSynthesisSample 12 | { 13 | /// 14 | /// An empty page that can be used on its own or navigated to within a Frame. 15 | /// 16 | public sealed partial class MainPage : Page 17 | { 18 | private MediaEngine mediaEngine= new MediaEngine(); 19 | 20 | public MainPage() 21 | { 22 | this.InitializeComponent(); 23 | } 24 | 25 | private async void Button_Click(object sender, RoutedEventArgs e) 26 | { 27 | var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); 28 | 29 | var stream = await synth.SynthesizeTextToStreamAsync("Hello World"); 30 | 31 | mediaEngine.PlayStream(stream); 32 | } 33 | 34 | private async void Page_Loaded(object sender, RoutedEventArgs e) 35 | { 36 | var result = await mediaEngine.InitializeAsync(); 37 | if (MediaEngineInitializationResult.Success != result) 38 | { 39 | Debug.WriteLine("Failed to start MediaEngine"); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | speechSynthesisSample 18 | Microsoft Corporation 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("speechSynthesisSample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft Corporation")] 12 | [assembly: AssemblyProduct("speechSynthesisSample")] 13 | [assembly: AssemblyCopyright("Copyright Microsoft Corporation © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.ApplicationInsights": "1.0.0", 4 | "Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0", 5 | "Microsoft.ApplicationInsights.WindowsApps": "1.0.0", 6 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" 7 | }, 8 | "frameworks": { 9 | "uap10.0": {} 10 | }, 11 | "runtimes": { 12 | "win10-arm": {}, 13 | "win10-arm-aot": {}, 14 | "win10-x86": {}, 15 | "win10-x86-aot": {}, 16 | "win10-x64": {}, 17 | "win10-x64-aot": {} 18 | } 19 | } -------------------------------------------------------------------------------- /samples/speechSynthesisSample/speechSynthesisSample/speechSynthesisSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x86 7 | {B53E30B4-BA67-4C66-979D-A000667FA248} 8 | AppContainerExe 9 | Properties 10 | speechSynthesisSample 11 | speechSynthesisSample 12 | en-US 13 | UAP 14 | 10.0.10581.0 15 | 10.0.10240.0 16 | 14 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | speechSynthesisSample_TemporaryKey.pfx 20 | 21 | 22 | true 23 | bin\x86\Debug\ 24 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 25 | ;2008 26 | full 27 | x86 28 | false 29 | prompt 30 | true 31 | 32 | 33 | bin\x86\Release\ 34 | TRACE;NETFX_CORE;WINDOWS_UWP 35 | true 36 | ;2008 37 | pdbonly 38 | x86 39 | false 40 | prompt 41 | true 42 | true 43 | 44 | 45 | true 46 | bin\ARM\Debug\ 47 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 48 | ;2008 49 | full 50 | ARM 51 | false 52 | prompt 53 | true 54 | 55 | 56 | bin\ARM\Release\ 57 | TRACE;NETFX_CORE;WINDOWS_UWP 58 | true 59 | ;2008 60 | pdbonly 61 | ARM 62 | false 63 | prompt 64 | true 65 | true 66 | 67 | 68 | true 69 | bin\x64\Debug\ 70 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 71 | ;2008 72 | full 73 | x64 74 | false 75 | prompt 76 | true 77 | 78 | 79 | bin\x64\Release\ 80 | TRACE;NETFX_CORE;WINDOWS_UWP 81 | true 82 | ;2008 83 | pdbonly 84 | x64 85 | false 86 | prompt 87 | true 88 | true 89 | 90 | 91 | 92 | 93 | PreserveNewest 94 | 95 | 96 | 97 | 98 | 99 | App.xaml 100 | 101 | 102 | MainPage.xaml 103 | 104 | 105 | 106 | 107 | 108 | Designer 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | MSBuild:Compile 124 | Designer 125 | 126 | 127 | MSBuild:Compile 128 | Designer 129 | 130 | 131 | 132 | 133 | {81d46002-ec95-4423-bf6e-dbe82ccd55ca} 134 | UniversalMediaEngine 135 | 136 | 137 | 138 | 14.0 139 | 140 | 141 | 148 | --------------------------------------------------------------------------------