Skip to main content
  1. Writing/

Trick Windows Phone OS Into Believing Your App Is The YouTube App

·539 words

Have you ever wondered if the default YouTube application can be replaced? With tight system integration to the level where it has its own URI scheme registered, it seems like it’s a sealed deal and developers can’t do anything about it. What developers don’t know is that it is possible to fully replace the default YouTube application as long as you take it’s identity.

Apparently Windows Phone OS recognizes applications by IDs only. I am already aware of several application IDs (that were, of course, published on XDA forums a while ago). YouTube doesn’t come with the OS image, so it is a completely separate entity. But the idea remains the same.

All you need to know is that the YouTube application GUID (ID) is:

dcbb1ac6-a89a-df11-a490-00237de2db9e

Now that you have it, you need to create an “impostor” WMAppManifest.xml with the app ID set to the one above. This works just fine:

<?xml version="1.0" encoding="utf-16"?>
<Deployment xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema" AppPlatformVersion="7.0" xmlns="https://schemas.microsoft.com/windowsphone/2009/deployment">
  <App Author="Dennis" Description="Do whatever you want here!" Genre="apps.normal" HubType="1" ProductID="{dcbb1ac6-a89a-df11-a490-00237de2db9e}" Publisher="Dennis" RuntimeType="Silverlight" Title="SomeRandomApp" Version="1.0.1013.1" xmlns="">
    <IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
    <Capabilities>
      <Capability Name="ID_CAP_NETWORKING" />
      <Capability Name="ID_CAP_IDENTITY_DEVICE" />
      <Capability Name="ID_CAP_MEDIALIB" />
    </Capabilities>
    <Tasks>
      <DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
    </Tasks>
    <Tokens>
      <PrimaryToken TokenID="YouTubeToken" TaskName="_default">
        <TemplateType5>
          <BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
          <Count>0</Count>
          <Title>
          </Title>
        </TemplateType5>
      </PrimaryToken>
    </Tokens>
  </App>
</Deployment>

Great! The application will now appear to the OS as the Microsoft-developed YouTube app. Remember that this application can do whatever it wants, not necessarily something related to YouTube.

So what more can you do, you might ask. Most of the YouTube app launches probably come from links on webpages that target YouTube videos. How about intercepting the video ID?

To do this, in the application constructor (in App.xaml.cs) I am adding an extra static field, called appUri:

Image lost since transition to new blog

If you expand the Phone application initialization region in the same class, you will see a method called CompleteInitializePhoneApplication and there is a comment that says not to add additional code. My line won’t hurt much, so I added code:

Image lost since transition to new blog

Now when the first page loads, I can read this field:

Image lost since transition to new blog

Oh and by the way, I can even use this application in the emulator (unlike the default YouTube application – it cannot be installed due to the locked account manager and inability to access Marketplace content directly).

First thing I do is navigate to a YouTube URL that has a link in the vnd.youtube scheme. The regular YouTube mobile page will do, so I am navigating to a video.

Image lost since transition to new blog

Once I click on Watch Video, I get redirected to my app (surprise!) and I am able to see the parameters sent to it:

Image lost since transition to new blog

All I need is a parser that will get the YouTube video ID (which, by the way, is a part of the YouTube library I recently disassembled) from the URL and I am set to create a new YouTube application with deep system integration.

Don’t forget that applications must not have conflicting IDs. I doubt an application with the ID belonging to the official YouTube application will be approved in the Marketplace.