jQuery Plug in JWPlayer Video Player Usage Example Analysis

  • 2021-07-10 18:35:06
  • OfStack

This article illustrates the use of jQuery plug-in JWPlayer video player. Share it for your reference, as follows:

How to use JWPlayer plug-in playback video player:


<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport"/>
  <meta content="telephone=no, address=no, email=no" name="format-detection">
  <title> Newsletter video preview </title>
  <style>
    .jwlogo{
      display: none;
    }
    #container{
      margin: auto;
    }
    #videoDiv{
      margin-top: 30px;
    }
  </style>
</head>
<body>
  <section id="videoDiv">
    <div id="container">Loading the player ...</div>
  </section>
</body>
<script type="text/javascript" src="/wamei/pages/js/jquery-1.11.3.min.js" ></script>
<script type="text/javascript" src="/wamei/pages/js/jwplayer/jwplayer.js"></script>
<script>
$(function(){
  var videoUrl = getUrlParam("videoUrl");
  var videoCover = getUrlParam("videoCover");
  if(videoUrl){
    jwplayer("container").setup({
      flashplayer : "/wamei/pages/js/jwplayer/player.swf",
      levels: [{file: videoUrl}],
      image: videoCover,
      height : 270,
      width : 480
    });
  }
});
// Get url Parameters in 
function getUrlParam(name) {
  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); // Structure 1 Regular expression objects with target parameters 
  var r = window.location.search.substr(1).match(reg); // Matching target parameters 
  if (r != null) return unescape(r[2]); return null; // Returns parameter values 
}
</script>
</html>

More readers interested in jQuery can check the topics of this site: "Summary of Common Plugins and Usage of jQuery", "Summary of Expansion Skills of jQuery", "Summary of Switching Effects and Skills of jQuery", "Summary of Traversal Algorithms and Skills of jQuery", "Summary of Common Classic Effects of jQuery", "Summary of Animation and Special Effects Usage of jQuery" and "Summary of Selector Usage of jquery"

I hope this article is helpful to everyone's jQuery programming.


Related articles: