nextplayer icon indicating copy to clipboard operation
nextplayer copied to clipboard

Feat: Video Chapter Management

Open mazen-salah opened this issue 1 year ago • 11 comments

Pull Request: Add JSON Import for Video Section Management

This pull request introduces a new feature that allows users to import a JSON file to define video sections, such as “Introduction”, “Chapter 1”, and other custom sections. This enhancement streamlines the organization of video content by enabling users to upload pre-structured data rather than manually entering sections.


New Features

1. JSON Import Functionality

  • Users can upload a JSON file via the user interface.
  • The JSON file must adhere to a predefined schema (detailed below).
  • Upon successful import, the sections are automatically mapped and displayed in the video editor interface.

2. Validation

  • Robust validation mechanisms for uploaded files:
    • Ensures the uploaded file is of the JSON format.
    • Verifies the structure of the JSON content against the predefined schema.
    • Provides error messages for invalid files or malformed content.

3. UI Updates

  • Added an “Import JSON” button in the Video Section Manager.
  • Enhanced error handling with user-friendly alerts for validation issues.

4. Schema Definition

The imported JSON file must follow this structure:

[
    {"title": "Introduction", "timestamp": 0},
    {"title": "Chapter 1", "timestamp": 60000},
    {"title": "Chapter 2", "timestamp": 120000},
    {"title": "Conclusion", "timestamp": 180000}
]

Screenshots/Demo

  1. Screenshot 1
  2. Screenshot 2

This feature simplifies workflow and ensures consistency in video section management for users.

mazen-salah avatar Dec 04 '24 06:12 mazen-salah

Hey @mazen-salah, this feature looks interesting! Regarding the JSON schema you used in the PR, is it a standard that's also used by any other apps, or is it something you came up with?

anilbeesetti avatar Dec 08 '24 04:12 anilbeesetti

Hi @anilbeesetti,

Thank you for the feedback! I came up with the JSON schema specifically to align with the needs of this feature, ensuring simplicity and ease of use for managing video sections.

Interestingly, I also developed a user script that extracts chapters from YouTube videos in the same JSON format used in this feature. This ensures consistency and makes the schema practical for users who may already be familiar with it or who want to manage video chapters across different platforms.

You can check out this user script and test its functionality here: YouTube Chapters to JSON.

I hope this adds value to the feature and provides additional context for its utility!

Looking forward to your thoughts.

mazen-salah avatar Dec 08 '24 05:12 mazen-salah

Also I’m working on a new feature to add bookmarks that can be exported in the same JSON schema for easy import or sharing.

mazen-salah avatar Dec 08 '24 05:12 mazen-salah

Screenshot 2024-12-08 at 7 34 18 AM Screenshot 2024-12-08 at 7 34 55 AM Screenshot 2024-12-08 at 7 36 13 AM

mazen-salah avatar Dec 08 '24 05:12 mazen-salah

@anilbeesetti I’m also working on streaming YouTube videos directly within the player to leverage its features and integrate them with the sections functionality. I’m exploring ways to automate this process so the JSON file won’t need to be imported manually.

https://github.com/user-attachments/assets/242313a9-1766-4e1f-86f1-be3ff2fcd444

I’ve attached a video demonstrating the progress so far.

mazen-salah avatar Dec 08 '24 06:12 mazen-salah

Hey @mazen-salah, this looks very interesting! I’m looking forward to seeing it completed. Just a heads-up: I’m currently working on migrating the player UI from XML to Jetpack Compose, so please avoid making any significant UI changes for now.

anilbeesetti avatar Dec 08 '24 06:12 anilbeesetti

Hi @anilbeesetti,

I’ve finished the current section feature, so feel free to test and merge this pull request. The YouTube streaming feature is already being developed in a separate branch, so this pull request can be considered completed. I will be opening the YouTube feature pull request soon.

mazen-salah avatar Dec 08 '24 06:12 mazen-salah

@anilbeesetti,

Just to update you, the YouTube streaming feature has already been written using Jetpack Compose. I’ll be opening the pull request for that soon as well.

Let me know if you need any further details!

mazen-salah avatar Dec 08 '24 06:12 mazen-salah

Do the "Sections" [0:08 in the video] actually respect the theme ?, because it looks like that dialog is always in white, despite the player/app being in dark theme...

drogga avatar Dec 08 '24 09:12 drogga

Hey @drogga, thank you for making me notice.

Screenshot_20241208_121740_Next Player Debug.jpg

Screenshot_20241208_121755_Next Player Debug.jpg

mazen-salah avatar Dec 08 '24 10:12 mazen-salah

Hi can I get a apk of this nextplayer

SunnyVishnu3 avatar Jul 13 '25 12:07 SunnyVishnu3