Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event data statement doesn't contain response in result object. #143

Open
ashraf7hossain opened this issue Aug 24, 2023 · 3 comments
Open

Comments

@ashraf7hossain
Copy link

ashraf7hossain commented Aug 24, 2023

I tried to extract event data from externalDispatcher but it doesn't contain result when I interact, after clicking finish button at the end it shows result but it doesn't contain any response and object id contains url with localhost I need data.statement like this form. Please help me and tell me if I am missing any configuration of h5pstandalone.

      "actor": {
        "name": "bs_232",
        "objectType": "Agent",
        "account": {
          "name": 91,
          "homePage": "LMS_URL"
        }
      },
      "verb": {
        "id": "http://adlnet.gov/expapi/verbs/answered",
        "display": {
          "en-US": "answered"
        }
      },
      "object": {
        "id": "LMS_URL/xapi/activity/1314?subContentId=e0a0c78b-c59f-4e0d-8796-0f716acb2ed6",
        "objectType": "Activity",
        "definition": {
          "extensions": {
            "http://h5p.org/x-api/h5p-local-content-id": 1,
            "http://h5p.org/x-api/h5p-subContentId": "e0a0c78b-c59f-4e0d-8796-0f716acb2ed6"
          },
          "name": {
            "en-US": "Fall from height"
          },
          "description": {
            "en-US": "How often do you encounter this?nnExample of tasksnWorking near an open hatchnClimbing laddersnLashing near a leading edgennAssociated risksnFalls causing disabling injury ornfatalityn"
          },
          "type": "http://adlnet.gov/expapi/activities/cmi.interaction",
          "interactionType": "choice",
          "correctResponsesPattern": [
            "0[,]1[,]2[,]3[,]4[,]5"
          ],
          "choices": [
            {
              "id": "0",
              "description": {
                "en-US": "Dailyn"
              }
            },
            {
              "id": "1",
              "description": {
                "en-US": "Weeklyn"
              }
            },
            {
              "id": "2",
              "description": {
                "en-US": "Monthlyn"
              }
            },
            {
              "id": "3",
              "description": {
                "en-US": "Yearlyn"
              }
            },
            {
              "id": "4",
              "description": {
                "en-US": "Nevern"
              }
            },
            {
              "id": "5",
              "description": {
                "en-US": "Not suren"
              }
            }
          ]
        }
      },
      "context": {
        "contextActivities": {
          "parent": [
            {
              "id": "LMS_URL/xapi/activity/1314",
              "objectType": "Activity"
            }
          ],
          "category": [
            {
              "id": "http://h5p.org/libraries/H5P.MultiChoice-1.16",
              "objectType": "Activity"
            }
          ]
        }
      },
      "result": {
        "score": {
          "min": 0,
          "max": 1,
          "raw": 1,
          "scaled": 1
        },
        "completion": true,
        "success": true,
        "duration": "PT61.66S",
        "response": "4"
      }
    },```
@0xMurage
Copy link
Collaborator

Have you resolved this issue?
If not, kindly share a demo of your player setup.

This package doesn't override the H5P core and content libraries, so everything should function as intended.

@ashraf7hossain
Copy link
Author

ashraf7hossain commented Nov 7, 2023

@0xMurage hello friend,
I was trying to integrate h5p in an ionic-angular (android) project . Here I was using your library and following code to show h5p content, It was working fine. But when I tried to get use interaction using externalDispatcher or other available methods I am not getting my desired information it doesn't give user interaction result.


  async ngOnInit() {
    // this.acr.queryParams.pipe(takeUntil(this.unsubscribe$)).subscribe((params) => {
    //   document.getElementById('h5p-container').innerHTML = '';
    //   this.hasLoaded = false;
    //   this.moduleId = +params['moduleId'];
    //   this.courseId = params['courseId'];
    //   this.courseName = params['courseName'];
    //   this.topicId = params['topicId'];
    //   this.loadContents();
    //   this.isFinal = finalModule(this.moduleId+'');
    // })

    const el = document.getElementById('h5p-container');
    const options = {
      h5pJsonPath: '/assets/h5p-test/contribute-your-own-ideas-181',
      frameJs: '/assets/frame.bundle.js',
      frameCss: '/assets/styles/h5p.css',
    };

    this.hasLoaded = true;

    await new H5PStandalone.H5P(el, options);

  //  console.log();
   const H5P = (window as any).H5P || {};
   H5P.externalDispatcher.on('xAPI', (event) => {
      //do something useful with the event
      console.log('xAPI event: ', event.data.statement);
    });
  }

contribute-your-own-ideas-181.zip
I need users choices from the h5p I attached above.
I am using h5p-standalone 3.5.1
Note: I also tried this method with raw angular project but that didn't work as well.

@ashraf7hossain
Copy link
Author

@0xMurage Hello friends could you reproduce the issue?

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

No branches or pull requests

2 participants