Hi,
I would like to create an external playlist, so that when the user clicks on a clip, the media associated with that clip gets loaded into a particular osmplayer.

My understanding is that I should execute the following when the user clicks on a clip:

minplayer.get(my_playerID, "player", function(player) {
  player.loadNode(my_mediadata);
});

My question:
I'm not sure how to package up the media associated with a clip, before passing it to loadNode(). What format is loadNode() expecting, for my_mediadata? I'm guessing this is documented somewhere, but I have been looking for a long time and haven't been able to find it.

Thanks very much for your help!
Mindy

Comments

travist’s picture

Status: Active » Fixed

Each node should be modeled according to what the RSS parser does... https://github.com/mediafront/osmplayer/blob/2.x/src/osmplayer.parser.rs...

Basically this...

minplayer.get(my_playerID, "player", function(player) {
  player.loadNode({
    title: 'My node',
    description: 'My description',
    mediafiles: {
      image:  {
        thumbnail: {path: 'url to thumbnail'},
        image: {path: 'url to preview image'}
      },
      media: {
        media: {path: 'url to media file'}
      }
    }
  });
});
kobnim’s picture

thank you!!

kobnim’s picture

Status: Fixed » Active

Hi Travis,

I have a follow-up question.

In player.loadNode(), is it possible to specify multiple media files? Something like:

minplayer.get(my_playerID, "player", function(player) {
  player.loadNode({
    title: 'My node',
    description: 'My description',
    mediafiles: {
      image:  {
        thumbnail: {path: 'url to thumbnail'},
        image: {path: 'url to preview image'}
      },
      media: {
        media1: {path: 'url to first media file'},
        media2: {path: 'url to second media file'},
        media3: {path: 'url to third media file'}
      }
    }
  });
});

There are two use cases I have in mind:
(a) The media files are videos. When the one video finishes playing, osmplayer continues to the next video.
(b) The media files are images. The osmplayer invokes a slideshow plugin to display the images.

Thanks very much.
Mindy

travist’s picture

Status: Active » Closed (fixed)

If you want a playlist capability, then you would want to use the playlist API to add a series of nodes to the playlist like this...

minplayer.get('playlist', function(playlist) {
  playlist.set({
    total_rows: 5,
    nodes: [
      {title: 'Node 1', mediafiles: {media: {media: {path: 'http://path_to_file'}}}},
      {title: 'Node 2', mediafiles: {media: {media: {path: 'http://path_to_file'}}}},
      {title: 'Node 3', mediafiles: {media: {media: {path: 'http://path_to_file'}}}},
      {title: 'Node 4', mediafiles: {media: {media: {path: 'http://path_to_file'}}}},
      {title: 'Node 5', mediafiles: {media: {media: {path: 'http://path_to_file'}}}}
    ]
  }, 0);
});
kobnim’s picture

thanks again!