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

qualitiesavailable event does not properly work #67

Open
Alexis-Vautier opened this issue Dec 16, 2021 · 1 comment
Open

qualitiesavailable event does not properly work #67

Alexis-Vautier opened this issue Dec 16, 2021 · 1 comment

Comments

@Alexis-Vautier
Copy link

Hello
I have an issue with the "qualitiesavailable" event. Every time I am using it, the only quality returned is 144P. I think it may be the preroll's quality. But, when the media starts, the "qualitiesavailable" is not called.

Is there a proper way to get the available qualities for a video and change the quality, without using the Dailymotion controls ? (I think the only way to do this is to reload the video, using the "start" and "quality" playerParameters)

Thanks;
Best regards,
Alexis

@Alexis-Vautier
Copy link
Author

So, I searched in Dailymotion SDK and it is not Preroll's quality.
In fact, there is an issue with the IOS SDK.

There was the same issue with Android :

dailymotion/dailymotion-player-sdk-android#56

If you check in the :
private static func parseEventAndParameters(from: String) method in the EventParser.swift file.

If juste add a condition :

private static func parseEventAndParameters(from: String) -> [String: String] {
    let splitedEvents = from.components(separatedBy: "&").map({ $0.components(separatedBy: "=") })
    var eventAndParameters: [String: String] = [:]
    for entry in splitedEvents {
      if let key = entry.first, let value = entry.last, !key.isEmpty, !value.isEmpty {
        **if let oldValue = eventAndParameters[key] {
            eventAndParameters[key] = oldValue.appending("|\(value)")
        } else {
            eventAndParameters[key] = value
        }**
      }
    }
    return eventAndParameters
  }

I just append all value, using a pipe to split them, instead of just remove the previous one. And...

Name qualitiesavailable -- Info Optional(["qualities[]": "1080|720|480|380|240|144"])

If you prefer a comma or an other typo, it does not matter. But can you please submit this fix ASAP please ?
Thanks.

Best regards,
Alexis

@RemiGuyon

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

No branches or pull requests

1 participant