npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

weex-plugin-kdp

v0.0.1

Published

weex-kdp extend for weex

Downloads

106

Readme

weex-kdp

Kaltura Dynamic Player implementation as Weex Components

Installing the plugin in your project

Using weexpack:

weex plugin add weex-kdp

Manual integration:

iOS:

pod 'WeexKdp'

Android:

Add the following line to the dependencies list in the build.gradle file for the corresponding project.

 compile '${groupId}:weexkdp:{$version}'

Note: You need to specify the groupId and $version of the project.

Web integration

 npm install weexkdp

API

Template

<weex-kdp>

Adds the weex-kdp plugin to the template. See Data: MediaEntry.

<weexKdp ref="kdp" MediaEntry="{/* MediaEntry */}"></weexKdp>

Calling methods

Use the sendNotification method to create custom notifications that instruct the player to perform an action, such as play, seek, or pause.

Example:

this.$refs.kdp.sendNotification("doSeek", 30);

Available Notifications

changeMediaEntry (ios)

Prepare for playing an entry. Play when it’s ready.

this.$refs.kdp.sendNotification('prepare', { /* media entry */});

doPlay (iOS)

Plays the video.

this.$refs.kdp.sendNotification('doPlay')

doPause (iOS)

Pauses the video.

this.$refs.kdp.sendNotification('doPause')

doSeek (iOS)

Sets the play time of the video.

  • (float) time.
this.$refs.kdp.sendNotification('doSeek',time)

changeVolume (NOT IMPLEMENTED)

Changes the volume. The volume is a value between 0 and 1.

  • (float) volume.
this.$refs.kdp.sendNotification('changeVolume', volume)

selectTrack (NOT IMPLEMENTED)

Selects a track by trackId. See tracksAvailable(callback).

  • (string) trackId.
this.$refs.kdp.sendNotification('selectTrack', trackId)

Getting player properties

Use the getProperty method to retrieve data from the plugin, such as duration, time, state, audioTrack, textTrack,

duration (iOS)

Returns the duration of the video.

  • callback: fn(duration) callback returning the duration of the video.
    • (float) duration
this.$refs.kdp.getProperty('duration', duration => {
    console.log(duration)
})

time (iOS)

Returns the current play time of the video.

  • callback: fn(duration) callback returning the plat time of the video.
    • (float) time: play time of the video
this.$refs.kdp.getProperty('time', time => {
    console.log(time)
})

state (NOT IMPLEMENTED)

Returns the current state of the video.

  • callback: fn(duration) callback returning the state of the video.
    • (string) state: the state of the video (idle, loading, ready, buffering, error)
this.$refs.kdp.getProperty('state', state => {
    console.log(state)
})

textTrack (NOT IMPLEMENTED)

Returns the current text trackId. See tracksAvailable(callback).

  • callback: fn(trackId)
    • (string) trackId
this.$refs.kdp.getProperty('textTrack', trackId => {
    console.log(trackId)
})

audioTrack (NOT IMPLEMENTED)

Returns the current audio trackId. See tracksAvailable(callback).

  • callback: fn(trackId)
    • (string) trackId
this.$refs.kdp.sendNotification('audioTrack', trackId => {
    console.log(trackId)
})

Listening to Events

Register player events with kBind and unregister events with kUnbind.

kBind(eventName, callback)

Registers an event.

  • eventName: name of the event (See Event List).
  • callback: fn(eventData) callback of the event.
this.$refs.kdp.kBind('onTimeChange', time => {
		// time = the player's progress time in seconds
	});

kUnbind(eventName)

Unregister an event.

this.$refs.kdp.kUnbind('onTimeChange');

Event List

timeChange (iOS)

Updates the callback each 500ms with the current time of the video.

  • callback: fn(currentTime) callback returning the current time of the video.
    • (float) currentTime
this.$refs.kdp.kBind('timeChange', (currentTime) => {
    console.log(currentTime)
})

stateChange (iOS)

Dispatched when media player's state has changed.

  • callback: fn(playerState)
    • (string) playerState: MediaPlayerState: uninitialized / loading / ready / playing / paused / buffering / playbackError
this.$refs.kdp.kBind('stateChange', state => {
    console.log('player state: ' + state)
})

durationChanged (NOT IMPLEMENTED)

Sent when enough data is available that the media can be played, at least for a couple of frames.

  • callback: fn()
this.$refs.kdp.kBind('durationChanged', newDuration => {
    console.log('Duration Changed to: ' + newDuration)
})

ended (NOT IMPLEMENTED)

Sent when playback completes.

  • callback: fn()
this.$refs.kdp.kBind('ended', () => {
    console.log('Ended')
})

loadedMetadata (NOT IMPLEMENTED)

The media’s metadata has finished loading; all attributes now contain as much useful information as they’re going to.

  • callback: fn(metadata)
    • (object) metadata
this.$refs.kdp.kBind('loadedMetadata', metadata => {
    console.log('Loaded Metadata: ' + JSON.stringify(metadata))
})

seeking (NOT IMPLEMENTED)

Sent when a seek operation begins.

  • callback: fn()
this.$refs.kdp.kBind('seeking', () => {
    console.log('Seeking')
})

seeked (NOT IMPLEMENTED)

Sent when a seek operation completes.

  • callback: fn()
this.$refs.kdp.kBind('seeked', () => {
    console.log('Seeked')
})

tracksAvailable (NOT IMPLEMENTED)

Sent when tracks available.

  • callback: fn(tracks)
    • (JSON) tracks: JSON with the available tracks in the format:
    {
      audioTracks: [
        {
          id: "id",
          title: "title",
          language: "language"
        },
        (...)
      ],
      textTracks: [
        {
          id: "id",
          title: "title",
          language: "language"
        },
        (...)
    }
this.$refs.kdp.kBind('tracksAvailable', tracks => {
    console.log('Tracks Available', tracks)
})

Data

MediaEntry

Description of the player configuration. Used in prepare and prepareNext. A media entry can have multiple sources that would be the same video in different formats. The player will choose the source more appropriate to the device.

{
    id: 'entryId',
    sources: [
      {
        contentUrl: 'url',
        mediaFormat: 'mediaFormat' // e.g. ".hls"
      }
    ]
}

Developing the plugin

See How to develop and the Plugin Development Guide.