⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playweb.jsp

📁 HomePlayer is an extention of the FreePlayer software provided by the french internet provider Free
💻 JSP
字号:
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.homeplayer.util.*"%>
<%@page import="org.homeplayer.data.*"%>
<%@page import="org.homeplayer.web.*"%>
<%@page import="java.util.Vector"%>
<%@page import="java.util.List"%>
<%@page import="com.sun.syndication.feed.synd.*"%>
<jsp:useBean id="hppc" class="org.homeplayer.web.HPPageContext" scope="request">
	<jsp:setProperty name="hppc" property="temporaryPage" 	value="true"/>
	<jsp:setProperty name="hppc" property="request" 		value="<%=request%>"/>
</jsp:useBean>

<%
hppc.setHeaderTitle( "WEB Player" ) ;

String accessProtocol = HPConf.getString(HPConf.REMOTE_APROTOCOL);
String accessRTPProtocol = "";
String serverName = request.getServerName();

if( accessProtocol.equals( "mmsh" ) && (hppc.getUserAgent().toLowerCase().indexOf("windows") != -1 && HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("VLC") == false)	||
	HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("TOT") || HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("MPL")) {

	accessProtocol = "mms";
}

if(accessProtocol.equals( "rtp" )){
	accessProtocol = "http" ;
	accessRTPProtocol = "rtp";
}

String url = WebUtil.getParam(request, "url", accessProtocol+"://"+(accessProtocol.equals("udp")?"@":"")+
		     serverName/*request.getLocalAddr()*/+(accessRTPProtocol.equals("rtp")?":8080/hp.sdp":":1234"));

HPSession.set("PLAY_URL", hppc.getLocalURL());
VLCControl vlc = VLCControl.shareInstance();
VLCInfo info = vlc.getInfo();

//set leftmenu items playlist

String mediatype = WebUtil.getParam(request, "MediaType", "FILM");
String media =  WebUtil.getParam(request, "Media", "");

int channelPos = WebUtil.getParam(request,"POS",-1) ;
MediaItem itemPlaying = info==null?null:info.getCurrentMedia() ;


MediaManager mgr = MultiMediaManager.shareInstance().getMediaManagerFor(mediatype) ;
MediaManager.setCurrentMediaManager(mgr) ;

Vector<MediaItem> medias=null;

if(mediatype.equals("PODCAST") && !media.equals("")) {
    medias = new Vector<MediaItem>();
	PodcastChannel podcast = (PodcastChannel) MediaManager.getCurrentMediaManager().getMediaItem(GUIDGenerator.makeGUID(media));
	RSSEntity parsedFeed = podcast.getRSSEntity(); //get the parsed feed
	List entries = parsedFeed.getEntries(); //get the entries
	SyndEntry entry = null;
	for (int i = 0; i < entries.size(); i++) {
	   entry = (SyndEntry) entries.get(i);
	   medias.add(podcast.getMediaItem(entry));
	}
	   
}else{
  medias = mgr.getMediaItems() ;
}

if( WebUtil.getParam(request,"STOP","").equals("")==false ) {
	
	vlc.action( "control=stop" ) ;
	itemPlaying = null ;
	
} else {
	if( info==null || info.getState().equals(VLCInfo.STATE_PLAYING) == false) {
		
		vlc.setServerAddress(serverName);
		
		if(accessProtocol.equals( "rtp" ) || accessProtocol.equals("udp")) {
			vlc.setOutAddress(request.getRemoteAddr());
		} else {
			vlc.setOutAddress(request.getLocalAddr()) ;
		}
		
	    vlc.playMedias(medias) ;
	    
	    if(channelPos !=-1){
	    	info = vlc.getInfo();
		    int id = Integer.parseInt(info.getFirstNodeID()) ;
		    System.out.println("ID : "+id);
		    vlc.action("control=play&item="+(id+channelPos)) ;
   		    itemPlaying = medias.get(channelPos) ;
	    }
	    
     } else if(info.getCurrentPlayList() == null) { //pas de playlist
    	 itemPlaying = info.getCurrentMedia();
     } else if( channelPos !=-1 ){ //une playlist et POS définies
    	 
    	 if(info.getCurrentPlayList().size() == medias.size()) { //la playlist correspond à l'ensemble des items
    		 int id = Integer.parseInt(info.getFirstNodeID()) ;
    		 vlc.action( "control=play&item="+(id+channelPos) ) ;
    		 itemPlaying = medias.get(channelPos) ; 
    	 }
       }
    itemPlaying = itemPlaying == null ? medias.get(0) : itemPlaying ;

}

hppc.setStopLink("action.jsp?next=playweb.jsp?MediaType="+mediatype+"&amp;control=stop");
hppc.setPauseLink("action.jsp?next=playweb.jsp?MediaType="+mediatype+"&amp;control=pause");

//System.out.println("prev : "+info.getPrevNodeID()+" current : "+info.getCurrentNodeID()+" next : "+info.getNextNodeID()+" playlist size : "+(info.getCurrentPlayList() !=null?info.getCurrentPlayList().size():1));
if(itemPlaying !=null && Integer.parseInt(info.getCurrentNodeID()) > Integer.parseInt(info.getFirstNodeID())) {
	hppc.setPreviousPageUrl("action.jsp?next=playweb.jsp?MediaType="+mediatype+"&control=play&item=" +info.getPrevNodeID());
}
		
if(itemPlaying !=null && info.getCurrentPlayList() !=null)
{
    hppc.setNextPageUrl("action.jsp?next=playweb.jsp?MediaType="+mediatype+"&control=play&item=" + info.getNextNodeID());
}


hppc.setLeftLink("javascript:volume_down()");
hppc.setRightLink("javascript:volume_up()");


hppc.setVolumeKeyEnabled(true);


String itemName= "Pas de Media";

if(itemPlaying != null && (vlc.getInfo().getState().equals(VLCInfo.STATE_STOP) == false || channelPos != -1)){
 itemName = itemPlaying.getTitle().length()>35 ?(hppc.isPocket()?itemPlaying.getTitle().substring(0,20)+"...":itemPlaying.getTitle().substring(0,35)+"..."):itemPlaying.getTitle();
	
}

hppc.setTopCommand("<li><a href=\"playweb.jsp?STOP=stop&MediaType="+mediatype+(media.equals("")?"":"&Media="+media)+"\" title=\"Stopper la lecture de "+(itemPlaying != null?itemPlaying.getTitle():" aucun media")+"\" class=\"link-menu\"><img src=\"/images/novaweb/stop16.gif\" alt=\"stop\" class=\"img-fav\" />"+
		           itemName+"</a></li><li><a href=\""+url+(hppc.isPocketIE()?"/*":"")+"\" title=\"URL du flux\" class=\"link-menu\"><img src=\"/images/novaweb/download.gif\" alt=\"down\" class=\"img-fav\" />url du flux</a></li>"+
		           (vlc.getInfo().getState().equals(VLCInfo.STATE_PLAYING)?"<li><a href=\"http://"+serverName+":8080/hp.m3u\" title=\"Playlist\" class=\"link-menu\"><img src=\"/images/novaweb/playlist16.gif\" alt=\"playlist\" class=\"img-fav\" />playlist</a></li>":""));

hppc.setMenuTitle(itemPlaying !=null && info.getState().equals(VLCInfo.STATE_STOP) == false?itemPlaying.getTitle():"Pas de Media");

//-------------------------------------------------------------------------------------------
//list lefmenu item list
//-------------------------------------------------------------------------------------------

int maxItemDisplay = hppc.isPocketIE() || hppc.isPSP()?5:16;
int start = WebUtil.getParam(request, "start", 0) ;

if (start > 0) {
	String prevURL = "playweb.jsp?MediaType="+mediatype+"&amp;start="+(start-maxItemDisplay);
	hppc.addMenuItem(new HPMenuPrevious(prevURL));
}

if(start+maxItemDisplay < medias.size()) {
    String nextURL = "playweb.jsp?MediaType="+mediatype+"&amp;start="+(start+maxItemDisplay);
    hppc.addMenuItem(new HPMenuNext(nextURL));
}

int pos = start ;
String title="";
for( int i=start; i<medias.size() && (i-start)<maxItemDisplay; i++) {

        //System.out.println("pos :" +pos+" "+medias.get(i).getPlayPath());
        String mediaPath = medias.get(i).getPlayPath();
        String playurl = "playweb.jsp?MediaType="+mediatype+"&amp;Media="+mediaPath+"&amp;POS="+(pos++);
        
        if(hppc.isPocket()) {
        	title = medias.get(i).getTitle().length() < 25?medias.get(i).getTitle():medias.get(i).getTitle().substring(0,25)+"...";
        }  else {
        	title = medias.get(i).getTitle().length() <15?medias.get(i).getTitle():medias.get(i).getTitle().substring(0,15)+"...";
        }
        
        
        hppc.addMenuItem(new HPMenuLink(title, playurl, "<img src=\"/images/novaweb/play.gif\" alt=\"..\" class=\"img-parentdir\" />&nbsp;"));

}
%>

<jsp:include page="<%= hppc.getSkin().getHeader() %>"/>
<jsp:include page="body.jsp"/>

<div id="mediaplayer">
<script type="text/javascript">
//<![CDATA[

    var _info = navigator.userAgent;
    var _vlc = <%= HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("VLC") %> || isVLCInstalled();
    var _qt = <%= HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("QT") %> || (isQTInstalled() && !isVLCInstalled());
    var _ie = <%= HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("WMP") %> ||<%= HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("TOT") %> || <%= HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("MPL") %> || (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0);
    var _real = <%= HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("REAL") %>;
    var _flv = <%= HPConf.getString(HPConf.REMOTE_WEB_MEDIA_PLAYER).equals("FLV") %>;
    
      if (_ie == true)
      {
         document.writeln('<object id="MyPLayer" name="MyPLayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" <%= (!hppc.isPocketIE())?"width=\"460\" height=\"460\"":"width=\"230\" height=\"230\""%>> \
					<param name="uiMode" value="full" /> \
					<pram name="autoStart" value="true" /> \
					<param name="stretchToFit" value="true" /> \
					<param name="BufferingTime" value="5" /> \
					<param name="URL" value="<%= url+(hppc.isPocketIE()?"//":"") %>" /> \
					<embed type="video/x-ms-asf-plugin" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="<%= url +(hppc.isPocketIE()?"//":"")%>" name="myTeaser" id="myTeaser" autostart="1" showcontrols="1" animationatstart="0" transparentatstart="1" AllowChangeDisplaySize="1" enableContextMenu="1" <%= hppc.isPocketIE()?"width=\"230\" height=\"230\"":"width=\"460\" height=\"460\""%> ShowStatusBar="1" /></object>');
                    
       } else if (_qt == true) {

         document.writeln('<object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="460" height="460" codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="flux"> \
                                        <param name="controller" value="true" /> \
                                        <param name="autoplay" value="true" /> \
                                        <param name="src" value="<%= url %>" /> \
                                        <embed width="460" height="460" name="flux" src="<%= url %>" type="video/quicktime" controller="true" autoplay="true" enablejavascript="true" />  \
                                        </object>');
       } else if(_real == true) {
       
        document.writeln('<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="460" height="460" align="left"> \
                         <param name="src" value="<%= url %>" /> \
                         <param name="autostart" value="-1" /> \
                         <param name="console" value="clip1" /> \
                         <param name="attr" value="value" /> \
                         <param name="controls" value="all" /> \
                         <embed align="left" src="<%= url %>" type="audio/x-pn-realaudio-plugin" width="460" height="460" console="clip1" controls="all" autostart="true" attr="value" /> \
                         </object>');
       
       } else if(_flv == true) {
       
        document.writeln('<object type="application/x-shockwave-flash" data="/script/player_flv.swf" width="460" height="345" id="player" name="flux"> \
	                     <param name="movie" value="/script/player_flv.swf" /> \
	                     <param name="FlashVars" value="flv=<%= url %>&amp;skin=/script/player_flv_skin.jpg&amp;margin=10&amp;showvolume=0<%= (WebUtil.getParam(request,"STOP","").equals("")==false?"":"&amp;autoplay=1&amp;autoload=1") %>&amp;showstop=1&amp;playercolor=ffffff&amp;buttoncolor=333333&amp;buttonovercolor=999999&amp;slidercolor1=333333&amp;slidercolor2=0&amp;sliderovercolor=999999&amp;loadingcolor=0" /> \
	                     <param name="wmode" value="transparent" /> \
                         </object>');
                         
       } else { //vlc mozilla plugin 
          
        document.writeln('<embed type="application/x-vlc-plugin" name="flux" autoplay="no" loop="yes" width="460" height="460" target="<%= url %>" />');
       
       }

function volume_up()
{
	var previous =  document.flux.get_volume();
        var newvolume = previous + 10;
	if( newvolume > 200 )  newvolume = 200;
	document.flux.set_volume( newvolume );

}

function volume_down()
{
	var previous =  document.flux.get_volume();
        var newvolume = previous - 10;
	if( newvolume < 0 )  newvolume = 0;
	document.flux.set_volume( newvolume );
        //var volume = document.getElementById("volume_status");
        //volume.innerHTML = "volume : " +document.flux.get_volume() + " %";
        //document.getElementById("volume_status").style.display = 'inline';
}


function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
	    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
		// if desired plugin name is found in either plugin name or description
		if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
		    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
		    // this name was found
		    numFound++;
		}   
	    }
	    // now that we have checked all the required names against this one plugin,
	    // if the number we found matches the total number provided then we were successful
	    if(numFound == daPlugins.length) {
		pluginFound = true;
		// if we've found the plugin, we can stop looking through at the rest of the plugins
		break;
	    }
	}
    }
    return pluginFound;
} // detectPlugin

function isVLCInstalled()
{   
  return detectPlugin('VLC');
}

function isQTInstalled()
{
  return detectPlugin('QuickTime');
}

function isTotemInstalled()
{
  return detectPlugin('Totem');
}

function isRealInstalled()
{
  return detectPlugin('Real');
}
//]]></script>
</div>
	
<jsp:include page="<%= hppc.getSkin().getFooter() %>"/>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -