Skip to content

Conversation

@J0nathan550
Copy link

@J0nathan550 J0nathan550 commented Jun 12, 2025

DONE:

  • splitting platform specific code to different .csproj
  • integrate permissions
  • update android manifest (name android proj properly, add proper icons)
  • fix main thread exceptions
  • ffmpeg compatibility
  • visual fixes

@Tyrrrz Tyrrrz added the enhancement New feature or request label Jun 13, 2025
@Tyrrrz Tyrrrz requested a review from Copilot June 13, 2025 16:46
@Tyrrrz Tyrrrz changed the title Implemented Android Avalonia Project Add support for Android Jun 13, 2025
@Tyrrrz
Copy link
Owner

Tyrrrz commented Jun 13, 2025

Thanks @josearias210 @J0nathan550 (sorry for mistag).

Were you able to get it working on an actual Android device?

This comment was marked as outdated.

@J0nathan550
Copy link
Author

Thanks @josearias210.

Were you able to get it working on an actual Android device?

you can run it on device, but there is no ffmpeg implemented to get path to it from resources and using it to convert files

when you are searching for items we need to make a UI thread to update the UI otherwise Java exception

the WebView is broken, when you auth (desktop) it opens the youtube page like you would normally login in browser youtube, it doesn't "auth" you completely.

there is no button for auth in Android version of app for some reason for now

there are a few minor visual bugs for dialogs, that you just add margin to them and they work fine.

There are no permissions added to "export" audio/video of file converted.

@J0nathan550
Copy link
Author

This PR is still ongoing, you can push it now and help me with development, or I can try to do everything myself and when I will finish with everything you can merge the pull

@J0nathan550
Copy link
Author

@Tyrrrz Progress:

  • Fixed ffmpeg path fetch
  • Now you can insert link and find the content you need to download
  • You can select path and "install" video (installing is not working because of desktop dependency for now)
  • Created permissions system that will allow us request any permission we like (already asked for needed one to install media)

@Tyrrrz Tyrrrz requested a review from Copilot June 14, 2025 13:00

This comment was marked as outdated.

@@ -0,0 +1,7 @@
arm
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do these directories/files come from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed "unused" arch and forgot to remove them from gitignore

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, when you are compiling the android project the powershell script at the time of compiling will install all of the binaries for android (like you did with ffmpeg) and will ignore them (not include them to git proj)

// Set execute permissions
try
{
var process = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well use CliWrap here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used your CliWrap. Sorry. If you wish to do it yourself you can later.

var currentArch = GetAndroidArchitecture();

// Remove any previously extracted FFmpeg binaries from other architectures
await Task.Run(() =>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this require a new Task?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove it

}
}

private static string GetAndroidArchitecture()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this method can just be inlined into a single switch expression

@J0nathan550 J0nathan550 requested a review from Tyrrrz June 19, 2025 22:24
@J0nathan550
Copy link
Author

Good enough Android MVP.

Would be good in future:

  • Add Notifications (to show in background what is downloading)
  • Add Foreground Service (when you download content it wouldn't exit app if you don't interact with it for long time). (Right now without it, I recommend installing content without going on background with app)
  • Add ability to open directory where file is located on phone
  • Add ability to play file on phone
  • Add Auth System

There are maybe things other things good to be added, but I am not aware of them right now.

Instructions on how to compile Release:

  1. Install MAUI essentials in Visual Studio 2022
  2. Run command: dotnet workload install android (powershell)
  3. Run another command: (powershell)
dotnet tool install -g Redth.Net.Maui.Check
maui-check
  1. Set YoutubeDownloader.Android as Startup Project
  2. Install Android Device Emulator in Visual Studio 2022
  3. Make sure that it is detectable. If for some reason it's not and you are sure that it's installed do this:
    • Close Visual Studio 2022
    • Go to project structure
    • In each different .csproj folder remove bin/obj
    • Open Again Visual Studio 2022
    • Select Android Project as Startup you should see API level device you need.
  4. Select Release in Build mode
  5. Build without running to debug
  6. Navigate to YoutubeDownloader.Android .csproj folder go to YoutubeDownloader.Android/bin/Release/net9.0-android/
  7. You will see com.tyrrrz.youtubedownloader-Signed.apk <- this is final APK to release.

@J0nathan550
Copy link
Author

@Tyrrrz Tyrrrz requested a review from Copilot June 22, 2025 16:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the Android platform by splitting the projects into platform‐specific csproj files, integrating Android permissions and manifest updates, and addressing issues such as main thread exceptions and FFmpeg compatibility.

  • Splits platform-specific code into separate projects for Android and Desktop
  • Integrates Android-specific permissions, resources, and manifest changes
  • Applies visual fixes and updates FFmpeg integration for cross-platform compatibility

Reviewed Changes

Copilot reviewed 45 out of 52 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
YoutubeDownloader/YoutubeDownloader.csproj Removed Windows-specific properties and upgraded Avalonia package versions
YoutubeDownloader/Views/*.axaml(.cs) Changed view inheritance (Window→UserControl) and updated layouts for improved UI consistency
YoutubeDownloader/ViewModels/* Adjusted platform-specific file handling and updated FFmpeg & program info references
YoutubeDownloader/Framework/* & Utils/* Changed internal types to public for broader accessibility as needed
YoutubeDownloader.Android/* Added new Android project with permissions, manifest, resource files, and FFmpeg initialization support
YoutubeDownloader.Desktop/* Created a new Desktop project for Windows with adjustments specific to desktop requirements

@J0nathan550 J0nathan550 requested a review from Tyrrrz June 22, 2025 18:33
@Tyrrrz
Copy link
Owner

Tyrrrz commented Dec 6, 2025

Some notes on the merge conflicts:

  • Download-FFmpeg.ps1: use the new file in both Desktop/Android. It should be compatible with both since FFmpegBin provides Android builds.
  • ProcessEx was moved to ProcessExtensions. If topLevel.Launcher works on all operating systems and not just Android, we should just use that instead of shell execute.
  • DashboardViewModel needs a closer look.
  • DownloadSingleSetupViewModel needs a closer look.
  • MainViewModel should be an easy merge.
  • YoutubeDownloader.csproj: copy-paste the new csproj over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants