Reply
New Member
bgordon
Posts: 2
Registered: ‎10-11-2011
0 Kudos

How To Assign Multiple Videos To A Player Dynamically (Without A Media API Write Token)

I am express user and don't seem to have the ability to create/use write api tokens.  As such, I seem unable to dynamically create playlists based on a series of video ids.

 

How else can I create players with numerous 2 - 300 videos assigned to them dynamically?

 

Background:  I am allowing my users to build a player to embed on their sites by completing a web form where they assign available videos to a playlist that I save in my db.  With a write token, I could build custom playlists at the same time and get that playlist id which I could the load using the player api...   However, since I cannot double my monthly costs to finish this project, I need another way to effectively push multiple Brightcove video ids into a tabbed player (or a thumbnail player).

 

Failing that, I guess I make my own pick list and when a choice is made, re-render the single video player with the selected video id, but this is not ideal (or as sexy).

 

Any advice would be appreciated.

 

Thanks!

Administrator
BC-Robert
Posts: 237
Registered: ‎02-12-2010
0 Kudos

Re: How To Assign Multiple Videos To A Player Dynamically (Without A Media API Write Token)

You can do it via the Player API -- the ContentModule has methods to retrieve videos from the server, as does the Search Module -- I'm delivering training on the Player API next Monday (http://www.brightcove.com/en/services/training) if you can wait that long, or if not, email me -- rcrooks@brightcove.com -- and I can send you a link to a recording of a previous class. Also attaching one of the class exercise solutions here that retrieves a set of videos via search (it works the same way via Content methods) and loads them into a list in the player.

 

Robert

New Member
bgordon
Posts: 2
Registered: ‎10-11-2011
0 Kudos

Re: How To Assign Multiple Videos To A Player Dynamically (Without A Media API Write Token)

That looks like it will do it!  I knew you guys would have a solution.

 

Can I use this same method by simply passing a series of video ids? I have the list of ids stored with each video player instance that my clients will build so I really need to just render a player just like in your excercise but have the list populated by the videos whose IDs I would pass a page render...

 

Can this method be used to created a tabbed player where I could send my ids in groups and have tabs with organized 'playlists' under each tab?

 

For example, I could would store 'Fish' 19129192,1219333,1212120  and 'birds' 2138978912,12379712983,213123

and end up with two tabs (fish and birds) and then the videos in those tabs?  All from using this method?

 

How would I modify the example to pass the ids instead of the search terms... is there a new method?

 

Thanks!

 

Bill

Administrator
BC-Robert
Posts: 237
Registered: ‎02-12-2010
0 Kudos

Re: How To Assign Multiple Videos To A Player Dynamically (Without A Media API Write Token)

Hi Bill,

 

Yes, there's another method for that: 

getMediaInGroupAsynch(ids:Array, property:String = "id"):void
Fetches multiple MediaDTOs from server, returning them in an array.
This is a method of the Content Module, so you could modify that sample I sent you pretty easily. Instead of
BCL.searchModule = BCL.player.getModule .... 
it would be 
BCL.contentModule = BCL.player.getModule(APIModules.CONTENT);
Then call your method, passing the IDs as an array -- the returned data will be in the same form, so you could use that same listener pretty much as is for the results. 
Robert