ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.01k stars 13.51k forks source link

bug: scorm lms api error . #27869

Closed amantarento closed 1 year ago

amantarento commented 1 year ago

Prerequisites

Ionic Framework Version

v4.x

Current Behavior

An error has occured: Error-unable to acquire LMS API, content may not play porperly and results man not be recorded

Expected Behavior

how to integrate lms api in ionic

Steps to Reproduce

use iframe to load the lms content .

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.4.3 (/home/aman/.nvm/versions/node/v14.17.6/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.7.0 @angular-devkit/build-angular : 0.901.15 @angular-devkit/schematics : 8.3.29 @angular/cli : 9.1.15 @ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 11.1.0 Cordova Platforms : android 10.1.2 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 49 other plugins)

Utility:

cordova-res : 0.15.4 native-run (update available: 1.7.2) : 1.7.1

System:

Android SDK Tools : 26.1.1 (/home/aman/Android/Sdk) NodeJS : v14.17.6 (/home/aman/.nvm/versions/node/v14.17.6/bin/node) npm : 6.14.15 OS : Linux 5.14

Additional Information

Test

sprakashg22 commented 1 year ago

Yes, we are also facing similar error and looking for an solution on this. Attached screenshot of the error message for reference.

Scorm-LMS

amantarento commented 1 year ago

can anyone help us here ?

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

averyjohnston commented 1 year ago

Thank you for the report. Can you also confirm whether this occurs on Ionic 7.x? Both Ionic 4 and Ionic 5 are no longer supported.

amantarento commented 1 year ago

hi @amandaejohnston this is my code <iframe #iframeElem title="HTML Content Viewer" i18n-title [src]="iframeUrl" (load)="onIframeLoadOrError('load',iframeElem,$event)" (error)="onIframeLoadOrError('error')" allow="fullscreen; accelerometer; autoplay; encrypted-media; gyroscope; microphone; camera;" class="html-iframe"> and here iframeUrl i am setting in ts file .here is sample of iframeUrl https://sunbirdcontent.s3-ap-south-1.amazonaws.com/content/html/do_11364358413983744011210-latest/index_lms.html

averyjohnston commented 1 year ago

Could you create a minimal Github repo demonstrating the issue and post a link to that instead? Having a runnable example will help us determine the source of the issue and whether the fix works down the road. Please also ensure that it uses the latest version of Ionic if possible.

amantarento commented 1 year ago

@amandaejohnston i can't use latest version of ionic because in my app there are other dependency also so i have to rely on the version which i have posted earlier.

averyjohnston commented 1 year ago

You may need to create a new app from scratch using the ionic start command, then add the necessary libraries. Your reproduction should only contain the code necessary to show the problem. It will also help to ensure that the problem only occurs with Ionic installed, as the issue may be in LMS, not Ionic.

amantarento commented 1 year ago

@amandaejohnston here we are not able to communicate between iframe and parent window . i have used this https://github.com/DadUndead/ngx-scorm-wrapper wrapper also but it did't work .

averyjohnston commented 1 year ago

hi @amandaejohnston this is my code <iframe #iframeElem title="HTML Content Viewer" i18n-title [src]="iframeUrl" (load)="onIframeLoadOrError('load',iframeElem,$event)" (error)="onIframeLoadOrError('error')" allow="fullscreen; accelerometer; autoplay; encrypted-media; gyroscope; microphone; camera;" class="html-iframe"> and here iframeUrl i am setting in ts file .here is sample of iframeUrl https://sunbirdcontent.s3-ap-south-1.amazonaws.com/content/html/do_11364358413983744011210-latest/index_lms.html

I noticed that if I open this example URL directly in my browser, I get the same error (screenshot below). Since the error occurs even without Ionic present, I am going to close this as not a bug in Ionic. I would recommend contacting technical support as mentioned in the error message.

error in browser

amantarento commented 1 year ago

@amandaejohnston you are not able to play this url (' https://sunbirdcontent.s3-ap-south-1.amazonaws.com/content/html/do_11364358413983744011210-latest/index_lms.html') in browser it need set of lms api method in window global variable like LMSInitialize,LMSFinish etc, i have declared this method in service but iframe window is not able to read the parent window and this is happening only in ionic app not in web view of angular .

averyjohnston commented 1 year ago

We will need a working reproduction app in order to triage the issue. I would recommend using the ionic start command to create a new Ionic starter app in the latest version, then add the iframe and any necessary API setup from there.

averyjohnston commented 1 year ago

After talking with the team on this, we've agreed that this is more of a support question. I'd recommend asking on the Ionic forums or Discord server for help. Closing this out with that in mind.

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue appears to be a support request. We use this issue tracker exclusively for bug reports and feature requests. Please use our forum for questions about the framework.

Thank you for using Ionic!