Example: Add from YouTube

Demonstrates how to enable the option to search YouTube directly and add items to the playlist.

Key features

  • Customisable button labels - rename "Add from YouTube", "Add from YouTube > Preview item", "Add from YouTube > Add as last" and "Add from YouTube > Add as next" to whatever you like.
  • Search for YouTube items directly within the Listy interface
  • Even when enabled, this option will only appear when the player has been rendered in Flash mode or is using JW Player 6.9+


CSS

HTML

  <div id="player_wrapper">
    <div id="example"></div>
  </div>

Setup code

  jwplayer("example").setup({
    "playlist":[{...}],
    "width":"100%",
    "aspectratio":"16:9",
    "plugins": {
      "listy.js":{
        "list":{
          "label":"My playlist"
        },
        "features":{
          "shuffle":{"enabled":true,"label":"Mix it up!"},
          "search":{"enabled":true},
          "edit":{
            "enabled":true,
            "label":"Edit",
            "buttons":{
              "move_up":{"enabled":true},
              "remove":{"enabled":true,"label":"REMOVE"},
              "move_down":{"enabled":true}
            }
          },
          "add":{
            "enabled":true,
            "label":"Add item",
            "options":{
              "form":{
                "label":"New item",
                "fields":{
                  "mediaid":{"label":"Media ID:","type":"hidden"},
                  "title":{"label":"Title:","value":"Example: JW Player promo"},
                  "description":{"label":"Description:","value":"Example: Your video solution starts with JW Player"},
                  "image":{"label":"Image URL:","value":"http://content.jwplatform.com/thumbs/HkauGhRi-640.jpg"},
                  "file":{"label":"File URL:","value":"http://content.jwplatform.com/videos/HkauGhRi-640.mp4"},
                  "type":{
                    "label":"Type:",
                    "type":"radio",
                    "options":{
                      "mp4":{"label":"MP4","checked":true},
                      "rtmp":{"label":"RTMP","checked":false},
                      "youtube":{"label":"YouTube","checked":false}
                    }
                  },
                  "duration":{"label":"Duration:","value":"mm:ss"},
                  "custom_field":{
                    "label":"Custom:",
                    "type":"checkbox",
                    "options":{
                      "custom_1":{"label":"Custom value 1","checked":true},
                      "custom_2":{"label":"Custom value 2","checked":false},
                      "custom_3":{"label":"Custom value 3","checked":true}
                    }
                  }
                },
                "buttons":{
                  "next":{"enabled":true,"label":"Add as next"},
                  "last":{"enabled":true,"label":"Add as last"},
                  "preview":{"enabled":true,"label":"Preview item"},
                  "custom_button":{"enabled":true,"label":"Custom button","action":function(a,b){
                      if(top.console){
                        console.info(jwplayer().plugins.listy.buildCustomItem());
                      }
                    }
                  }
                }
              },
              "from_removed":{
                "label":"From removed",
                "enabled":true,
                "buttons":{
                  "preview":{"enabled":true,"label":"Preview"},
                  "last":{"enabled":true,"label":"+Last"},
                  "next":{"enabled":true,"label":"+Next"}
                }
              }
            }
          }
          "add_from_yt":{
            "enabled":true,
            "label":"Add from YouTube",
            "buttons":{
              "preview":{"enabled":true,"label":"Preview"},
              "last":{"enabled":true,"label":"+Last"},
              "next":{"enabled":true,"label":"+Next"}
            }
          }
        }
      }
    }
  });