Skip to content

Conversation

@AhmarZaidi
Copy link
Contributor

@AhmarZaidi AhmarZaidi commented Jan 1, 2026

Issue - #1211

Enables AI transcription generation directly from WordPress block editor, eliminating the need to visit GoDAM Central.

Block Editor Changes

  • Added a block inspector control to trigger AI based caption generation for the selected video attachment in godam/video block's edit.js. The control has loading, disabled, and error states during the transcription flow.
  • Added ai-transcription rest endpoint to handle communication with the Frappe Backend APIs.
  • On mount, the block checks whether a transcription already exists for the attachment and updates the UI to prevent regeneration. It first checks in the postmeta with key rtgodam_transcript_path and if not present then it hits the get backend api.
  • Generated caption tracks (link to the generated .vtt file) are fetched from attachment metadata or the backend api and saved into block attributes to keep editor preview and frontend output consistent.
  • The captions control in the video player is automatically enabled once tracks are present, both in the editor and on the frontend.
  • API errors during transcription are shown using notices.

Testing Instructions

  1. Select video in GoDAM video block
  2. Click "Generate AI Transcription" in settings (Inspector Controls)
  3. Wait for processing (loading state shown)
  4. Tracks automatically added → CC button appears on refresh on both editor and frontend

Screenshots & Demo

Before Generation

image

After Generation

image

Error Notice

image

Demo

GoDam.Generative.AI.Transcript.mov

Remaining

  • Fix frontend player showing same track multiple times [FIXED].
  • Handle document modified notice gracefully -> Should be fixed on backend.
  • Fix the requirement to reload page to see the captions button in editor player (check priority)

- Add generate transcript button to godam video block settings
- Handle button states
- Add notices to show errors
- Add AI transcript logo
@AhmarZaidi AhmarZaidi self-assigned this Jan 1, 2026
Copilot AI review requested due to automatic review settings January 1, 2026 08:50
@github-actions
Copy link

github-actions bot commented Jan 1, 2026

🔍 WordPress Plugin Check Report

❌ Status: Failed

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
29 12 17

❌ Errors (12)

📁 inc/classes/wpforms/wpforms-field-godam-record-frontend.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/wpforms/wpforms-field-godam-record-entry-view.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/wpforms/wpforms-field-godam-record-entry-edit.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/class-rewrite.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/class-elementor-widgets.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/everest-forms/everest-forms-field-godam-record-frontend.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/assets/class-ima-assets.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/assets/class-jetpack-form-assets.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/class-video-preview.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/lifter-lms/class-lifter-lms.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/fluentforms/class-form-submit.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;
📁 inc/classes/class-video-engagement.php (1 error)
📍 Line 🔖 Check 💬 Message
0 missing_direct_file_access_protection PHP file should prevent direct access. Add a check like: if ( ! defined( 'ABSPATH' ) ) exit;

⚠️ Warnings (17)

📁 composer.json (1 warning)
📍 Line 🔖 Check 💬 Message
0 missing_composer_json_file The "/vendor" directory using composer exists, but "composer.json" file is missing.
📁 readme.txt (2 warnings)
📍 Line 🔖 Check 💬 Message
0 mismatched_plugin_name Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM".
0 trademarked_term The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name.
📁 inc/classes/media-library/class-media-folder-utils.php (1 warning)
📍 Line 🔖 Check 💬 Message
91 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_clause used in $wpdb->get_var($wpdb->prepare(\n\t\t\t\t"\n\t\t\tSELECT COUNT(DISTINCT p.ID)\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tINNER JOIN {$wpdb->term_relationships} tr ON p.ID = tr.object_id\n\t\t\tINNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id\n\t\t\tWHERE {$where_clause}\n\t\t",\n\t\t\t\t$query_params\n\t\t\t))\n$where_clause assigned unsafely at line 82:\n $where_clause .= ' AND p.post_mime_type LIKE %s'\n$query_params[] used without escaping.\n$mime_type used without escaping.
📁 assets/build/css/main.css (1 warning)
📍 Line 🔖 Check 💬 Message
0 EnqueuedStylesScope This style is being loaded in all contexts.
📁 assets/src/libs/analytics.min.js (6 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?p=1 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?page_id=2 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?attachment_id=6 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?godam-video=demo-godam-video-post (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
📁 assets/build/js/main.min.js (6 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?p=1 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?page_id=2 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?attachment_id=6 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/?godam-video=demo-godam-video-post (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

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 pull request implements AI-powered transcription generation directly from the WordPress block editor for GoDAM video blocks, removing the need to use GoDAM Central for this functionality.

Key Changes:

  • Added REST API endpoints (/godam/v1/ai-transcription/get and /godam/v1/ai-transcription/process) to communicate with the Frappe backend transcription service
  • Integrated an AI Transcription control in the video block's inspector panel with loading, disabled, and error states
  • Implemented automatic transcription detection on block mount to prevent duplicate generation and ensure tracks are available in both editor and frontend

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
inc/classes/rest-api/class-ai-transcription.php New REST API class handling transcription retrieval and processing with backend API communication
inc/classes/class-plugin.php Registers the new AI_Transcription REST API class in the plugin initialization
inc/templates/godam-player.php Adds duplicate track prevention logic to avoid showing AI transcription multiple times
assets/src/blocks/godam-player/edit.js Integrates transcription checking on mount and adds AI transcription component to inspector controls
assets/src/blocks/godam-player/components/AITranscription.js New React component providing the UI for generating AI transcriptions with appropriate states
assets/src/blocks/godam-player/editor.scss Styles for the AI transcription control component
assets/src/images/ai-transcript.svg SVG icon for the AI transcription feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AhmarZaidi AhmarZaidi requested a review from subodhr258 January 1, 2026 12:15
Copy link
Member

@mi5t4n mi5t4n left a comment

Choose a reason for hiding this comment

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

Left some comments in the PR.

- Added missing translations
- Added since n.e.x.t
- Remove validate callback and use core features
- Update status codes
- Bail early for missing api key
- Bail early on error
- Update permission callback
- Update valid transcript url check
@AhmarZaidi
Copy link
Contributor Author

@mi5t4n

Implemented the feedbacks #1438 (review)

@AhmarZaidi AhmarZaidi requested a review from mi5t4n January 8, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants