# IntentsKitVideoContinue **Repository Path**: easy1228/IntentsKitVideoContinue ## Basic Information - **Project Name**: IntentsKitVideoContinue - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 4 - **Created**: 2025-08-14 - **Last Updated**: 2025-08-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Intent-Based Video Continuation Recommendation ## Introduction - This example is based on the intent framework, using `@kit.IntentsKit` to implement intent sharing and `@kit.AbilityKit`'s `InsightIntentExecutor` to achieve intent invocation. Video continuation is realized based on the parameters passed during intent invocation. ## Preview | Home page | Playback page |Xiaoyi Card Display Shared Intent | Click the intent card to continue. | |---------------------------------------------------------|----------------------------------------------------|------------------------------------------|----------------------------------------------------| | ![show home page](screenshots/device/1.png "show page") | ![video playback](screenshots/device/2.png "video playback") |![Xiao Yi suggests displaying interface 0](screenshots/device/3.png "Xiao Yi suggests displaying interface 0") | ![Intent to call 0 ](screenshots/device/2.png "Intent to call 0 ") | Instructions: 1. Click the card for `Demo Video 1 or 2` to enter the video playback page. The playback will automatically trigger the call to the shareIntent() interface. The status of the interface execution will be displayed at the bottom of the video page. 2. Once the system completes processing the shared intent, the shared intent will be displayed within the Xiaoyi suggestion card. 3. Click the corresponding Xiaoyi card to relaunch the sample application and continue playing the video. ## Project Directory ``` entry/src/main/ ├──ets | ├──common/constants | | └──CommonConstants.ets // Common constants | └──common/utils | | ├──FileReader.ets // File reader | | └──Logger.ets // Logger | ├──entryability | | └──EntryAbility.ets // Entry Ability | ├──insightintents | | └──IntentExecutorImpl.ets // Intent invocation class | └──pages | ├──Index.ets // Home page | └──PlayPage.ets // Video playback page └──resources ├──base | ├──profile | | ├──insight_intent.json // Intent registration configuration | | └──main_pages.json // Application page list └──rawfile ├──shareIntent.json // Example intent sharing data └──video.json // Example video information ``` ## Implementation Details The intent sharing source code can be found in the `shareIntent` method in `PlayPage.ets`, and the intent invocation source code is in the `onExecuteInUiAbilityForegroundMode` method in `IntentExecutorImpl.ets`. - **Home Page**: Reads video information from the `video.json` file and generates video cards using `ForEach`. The `onClick` event of the cards triggers a jump to the video playback page via `navPathStack.replacePathByName`. - **Video Playback Page**: Based on the video ID, the playback progress is retrieved using `videoPreference` preferences, and playback resumes from the specified progress by calling `controller.setCurrentTime`. - **Intent Sharing**: The `Video` component on the playback page calls the `shareIntent` method during the `onStart` event. Based on the video ID, relevant intent data is filtered from the pre-read `shareIntent.json` data, and the `insightIntent.shareIntent` API is called to share the intent data. - **Intent Invocation**: In the `onExecuteInUIAbilityForegroundMode` method, an `eventHub.emit` broadcast event is used to pass the `entityId` (video ID) parameter. `Index.ets` listens for the event via `eventHub.on` and triggers a jump to the video playback page via `navPathStack.replacePathByName`. - For hot starts, parameters are passed to the home page via `eventHub`. For cold starts, the `onCreate` method uses the `localStorage` object to pass specific `want` parameters to the home page. - This example does not heavily involve business or UI logic for intent invocation. Instead, it passes relevant parameters to the business through different channels, leaving the initiative for page jumps to the business itself. The `onExecuteInUIAbilityForegroundMode` interface also provides a `WindowStage` instance, allowing the use of `windowStage.loadContent` to load specific pages. Applications can choose the appropriate method based on actual needs. ## Timing interaction diagram ![Timing interaction diagram](screenshots/timing_diagram.png) ## Required Permissions ### Dependencies 1. This example depends on `@ohos/hvigor-ohos-plugin`. 2. If using a DevEco Studio version newer than the recommended version for this example, update the hvigor plugin version as prompted by DevEco Studio. 3. An internet connection is required to log in to a Huawei account and agree to Xiaoyi Suggestions' user agreement and privacy policy. ### Constraints 1. **Testing for intent sharing and invocation cannot be independently completed by developers. Please follow the [Intents Kit integration process](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/intents-habit-rec-dp-self-validation) and submit an acceptance application via email to the Huawei intent framework contact. The contact will assist the developer in completing the testing and acceptance.** 2. This example only runs on standard systems and supports Huawei phones and tablets. 3. HarmonyOS version: HarmonyOS 5.0.5 Release or later. 4. DevEco Studio version: DevEco Studio 5.0.5 Release or later. 5. HarmonyOS SDK version: HarmonyOS 5.0.5 Release SDK or later.