Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

onUpdateStatus gets called with bad params #8

Closed
mr-tichyt opened this issue Jun 11, 2018 · 2 comments
Closed

onUpdateStatus gets called with bad params #8

mr-tichyt opened this issue Jun 11, 2018 · 2 comments
Assignees

Comments

@mr-tichyt
Copy link

The onUpdateStatus of IMediaNotifier interface...

    /**
     * @param {PlaybackStatus} status
     * @param options
     */
     onUpdateStatus(status: PlaybackStatus, options: any): void;

...should be called with first argument as PlaybackStatus described like this:

export declare class PlaybackStatus {
    state: EnumMediaStatus;
    volume: number;
    mute: boolean;
    position: number;
    duration: number;
    /**
     * @constructor
     * @param {EnumMediaStatus} state - Media Status
     * @param {number} volume - Audio volume
     * @param {boolean} mute - Mute OnOff Value
     * @param {number} position - Current Position
     * @param {number} duration - Duration
     */
    constructor(state: EnumMediaStatus, volume: number, mute: boolean, position: number, duration: number);
}

Sometimes it gets the EnumMediaStatus instead:

/**
 * Media Status Enum
 */
export declare enum EnumMediaStatus {
    IDLE = "idle",
    BUFFERING = "buffering",
    PLAYING = "playing",
    PAUSED = "paused",
    STOPPED = "stopped",
    CANCELLED = "cancelled",
    ERROR = "error",
}

It happens here (media.ts:204):

// Dispatch Event If Needed
    if (previousStatus !== this.mediaElement.status) {
      this.mediaChannel.onUpdateStatus(this.mediaElement.status);
    } else if (
      this.updateFrequency !== 0 &&
      newUpdate > this.lastUpdate + this.updateFrequency * 1000
    ) {
      this.lastUpdate = newUpdate;
      this.mediaChannel.onUpdateStatus(this.getPlaybackStatus());
    }

Thank you,
Tomas

@sebdurand
Copy link
Collaborator

hi Tomas,
could I see the JS implementation of this SDK part? I do not identify the origin of the problem with only these elements.

@mr-tichyt
Copy link
Author

Hello Sebastien,

I am not sure what do you need. The problem is in media.ts:204, as I wrote and it is about two different types being sent to that event handler. One time it is string (EnumMediaStatus), other time object (PlaybackStatus). It should always be the PlaybackStatus object.

Regards, Tomas

sebdurand added a commit that referenced this issue Jul 19, 2018
* fix rollup export interface @see rollup/rollup-plugin-typescript#28

* fix attach/detach listeners after load/clear

* fix return id tracks not implemented

* fix attach/detach listeners after load/clear

* fix return id tracks not implemented

* Update package.json

* Update package.json

* add skip_cleanup: true / deploy / npm
@sebdurand sebdurand reopened this Jul 19, 2018
sebdurand added a commit that referenced this issue Jul 19, 2018
* 1.0.3 (#3)

* refactoring : playbackstatus as int

* fix reply connection status

* fix getMetadata

* fix tracks

* fix format code

* 1.0.4 (#12)

* refactoring : playbackstatus as int

* fix reply connection status

* fix getMetadata

* fix tracks

* fix format code

* Fix playback status, connection status, metadata and tracks support.

* refactoring : playbackstatus as int

* fix reply connection status

* fix getMetadata

* fix tracks

* fix format code

* fix npmjs deploy

* fix npm deploy

* fixes #6 #7 #8 #9 #13  (#18)

* fix rollup export interface @see rollup/rollup-plugin-typescript#28

* fix attach/detach listeners after load/clear

* fix return id tracks not implemented

* fix attach/detach listeners after load/clear

* fix return id tracks not implemented

* add skip_cleanup: true / deploy / npm

* update protocol

* fix handle propertly transmission errors
juliendelage added a commit that referenced this issue Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants