如何通过Web浏览器打开此文件(通过它启动应用程序)?

时间:2017-09-12 16:24:58

标签: javascript html web-applications

我一直在尝试打开扩展名为.con的文件;只能由为其封装的视频文件的特定编码而设计的特定应用程序打开。

但是,该应用程序只能通过Web浏览器启动。

提供这些文件的实际网站具有格式的网址   starplayer://<url>bolwl6pIrBrL1GEf7V%2F5Uy6eoFPW77xb5jrS%2BCqRb3%2BoaVq%2Fm3REcqkDQzNsEu2JH6Q2ysUzG73Is93y%2FhmRNK10znrzHKOmEcFITgVDIQeGRVDk7iMBeDth%2BNzmZLIK1yDadYIyBvUPAJ4JRiHzevUVOQ8FMVUJzWAtA5qONGf40KaP31iKvMICFJ3lRjI1cuclOg4KxDo8GeQfmsS7xCAbX1XSWMNlEQ%2Fqzaaht2Gj1fWfbgo%2FsJbGVGSr5swv7ezk4S77LV%2BLpT%2FGbRLbovv0X%2BE4bAQFBtbxfsJ%2BjRU%3D<base_url>http%3A%2F%2Fwww.etoosindia.com%2F<width>720<height>500<topmost>true<resizing>undefined<cookie>X2dhPUdBMS4yLjM2NzU5MzMwNS4xNDk4MjExMjczOyBjb29raWVfdWlkPTsgbWVtX25tPVpHOXVkQ0JqWVd4czsgbWVtX2lkPVoyeHdaM1ZvWkdOQWMyaGhjbXRzWVhObGNuTXVZMjl0OyBtZW1fY2Q9TnpreU1EVTU7IF9femxjbWlkPWhBZ1hnVGM4bU1Iekxl<caption>RXRvb3MlMjBJbmRpYQ%3D%3D

该网址会打开播放器加载的IE框架。

现在我尝试打开文件,在地址栏中输入;

starplayer://<url>C:\Users\Sciencyboi\Desktop\1.con

但它会提示下载文件而不是播放文件。

我再次尝试过这个; (基本上改变了原始网址和基本网址)

starplayer://<url>file:\\C:\Users\Sciencyboi\Desktop\1.mp4<base_url>undefined<width>720<height>500<topmost>true<resizing>undefined<cookie>X2dhPUdBMS4yLjM2NzU5MzMwNS4xNDk4MjExMjczOyBjb29raWVfdWlkPTsgbWVtX25tPVpHOXVkQ0JqWVd4czsgbWVtX2lkPVoyeHdaM1ZvWkdOQWMyaGhjbXRzWVhObGNuTXVZMjl0OyBtZW1fY2Q9TnpreU1EVTU7IF9femxjbWlkPWhBZ1hnVGM4bU1Iekxl<caption>RXRvb3MlMjBJbmRpYQ%3D%3D

starplayer://<url>1.con<base_url>C:\Users\Sciencyboi\Desktop\<width>720<height>500<topmost>true<resizing>undefined<cookie>X2dhPUdBMS4yLjM2NzU5MzMwNS4xNDk4MjExMjczOyBjb29raWVfdWlkPTsgbWVtX25tPVpHOXVkQ0JqWVd4czsgbWVtX2lkPVoyeHdaM1ZvWkdOQWMyaGhjbXRzWVhObGNuTXVZMjl0OyBtZW1fY2Q9TnpreU1EVTU7IF9femxjbWlkPWhBZ1hnVGM4bU1Iekxl<caption>RXRvb3MlMjBJbmRpYQ%3D%3D

它显示&#34;导航到网页已取消&#34;

我还尝试在播放器加载之前打开IE框架之后将源保存为html文件,这是;

&#13;
&#13;
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>FREE IIT JEE Main Coaching Online, IIT JEE Video Lectures & Free Mock Test</title>
  
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<script type="text/javascript" charset="utf-8" src="/js/jquery/jquery-1.11.3.js"></script>
<script type="text/javascript" src="/js/starplayer/starplayer_config.js?v=20160801"></script>
<script type="text/javascript" src="/js/starplayer/starplayer.js"></script>
<script type="text/javascript">
	var player;
	var recodePlayedTime = null;
	var userPlayedTime = 0;

	
	var step_;
	step_ = 10;
	
	function getStep() {
		return step_;
	}
			
	function setStep(step) {
		step_ = step;
	}

	function onMouseDbclick(x, y) {
		player.setFullscreen(!player.getFullscreen());
	}

	function onKeyDown(keycode) {
		if (window.event) {
			var type = window.event.srcElement.type;
			if (type == "text" || type == "textarea")
				return true;
		}
		switch (keycode) {
			case 13: // ENTER
				player.setFullscreen(true);
				break;
			case 32: // SPACE
				if (player.getPlayState() == PlayState.PLAYING)
					player.pause();
				else 
					player.play();
				break;
			case 38: // UP
				player.setVolume(player.getVolume() + 0.1);
				break;
			case 40: // DOWN
				player.setVolume(player.getVolume() - 0.1);
				break;
			case 37: // LEFT
				player.backward(getStep());
				break;
			case 39: // RIGHT
				player.forward(getStep());
				break;
			case 190: // >
				player.setRate(player.getRate() + 0.2);
				break;
			case 188: // <
				player.setRate((player.getRate() - 0.2) < 0.6 ? 0.6 : (player.getRate() - 0.2));
				break;
			case 77: // M
				player.setMute(!player.getMute());
				break;
			case 82: // R
				player.setRepeat(!player.getRepeat());
			default:
				return;
		}
		return false;
	}

	function onPlayStateChange(state) {
		switch (state) {
			case PlayState.PLAYING:				
				// 진도율 정보 전송
				if(checkTimeInterval == null) {
					checkViewTime();					
				}
				
				player.setVisible(true);
				break;
			case PlayState.PAUSED:
				// 시간체크 중지 
				if(userPlayedTime > 0) {
					clearInterval(recodePlayedTime);
					recodePlayedTime = null;
				} 
				break;
			case PlayState.STOPPED:
				// 시간체크 중지 
				if(userPlayedTime > 0) {
					clearInterval(recodePlayedTime);
					recodePlayedTime = null;
				} 				
				player.setVisible(false);
				break;
			case PlayState.BUFFERING_STARTED:
				break;
		}
	}
			
	function onError(error_code) {
		 player.setVisible(true);
		 switch (error_code) {
		  case StarPlayerError.MULTIPLE_CONNECTIONS:
		   alert("Multi Connection Error");
		 };
	}

	function onLoad(){
		var errMsg = '';
		
		if( errMsg != '' ) {
			alert(errMsg);
			self.close();
		} else {
			var config = {
					userId: 'ponipux@seekjobs4u.com',
					id: "starplayer",
					videoContainer: "video-container",
					controllerContainer: "controller-container",
					controllerUrl: "axissoft3.bin",
					visible:false
					
				};
				
			var startTime = '1';
				
			var media = {
					url: 'C:\Users\Sciencyboi\Desktop\1.mp4', 
					startTime: parseInt(startTime, 10),
					blockMessenger: false
			};
					
			player = new StarPlayer(config, media);
			player.onKeyDown = onKeyDown;
			player.onMouseDbclick = onMouseDbclick;
			player.onPlayStateChange = onPlayStateChange;
			player.onError = onError; 			
		}
	}
	
	// 강의수강부분 체크 interval
    var checkTimeInterval = null;
	
    function checkViewTime() {
    	var intervalTime = 1000 * 180;
    	intervalTime = parseInt( intervalTime / player.getRate() );
    	clearInterval(checkTimeInterval);
    	checkTimeInterval = setInterval(function() { checkViewTimeAjax() }, intervalTime);
    }

    // 진도율 정보 전송
    function checkViewTimeAjax() {
    	
    	try{
    		
    		var duration = player.getDuration();
    		var currentPostion = Math.round( player.getCurrentPosition() );
    		var speed = player.getRate();
    		
    		var VP_TIME = userPlayedTime;
    		var VP_RATE = Math.round( parseInt( currentPostion, 10 ) / parseInt( duration, 10 ) * 100 );
			
    		if( isNaN(VP_RATE) || VP_RATE < 0 )
    			VP_RATE = 0;
    		
    		var ppdSeq = '5721540';
    		var godSeq = '12952';
    		var vidSeq = '15698';
    		var memCd = '796707';
    		
    		var param = {
       				"PPD_SEQ" : ppdSeq
       			,	"GOD_SEQ" : godSeq
       			,	"VID_SEQ" : vidSeq       			
       			,	"MEM_CD"  : memCd      				
    			,	"VP_RATE" : VP_RATE    				
    			,	"VP_TIME" : currentPostion
    			,	"VP_TIME_USER" : 0
    			,	"DURATION" : duration
    		};
    		
    		$.ajax({
    				url : '/common/checkViewTime.do' 
    			,	dataType : 'json'
    			,	method : 'post'
    			,	data : param
    			,	header : { Connection : close }
    			,	success : function(data) {
    			
    			}
    		});
    	}catch(e){
    		alert(e);	
    	}
    }	
</script>

<style type="text/css"> 
	table {
		border-collapse:collapse;
	}
		
	table, td {
		border:0px solid red;
		padding:0;margin:0;
	}
</style>
 
</head>

<body style="margin: 0 0 0 0" onload="onLoad()" onkeydown="onKeyDown(event.keyCode)">
	<table id="player-container" style="width:720px;">
		<tr><td id="video-container" style="height:406px;background:#fafafa url('') no-repeat center center;"></td></tr>
		<tr><td id="controller-container" style="height:81px;"></td></tr>
	</table>
</body>

</html>
&#13;
&#13;
&#13;

&#34; var media =&#39; ---&#39;&#34;在上面的代码中由我更改以尝试运行该文件。(使用&#34; C:\ js&#34;目录中的其他脚本)

上面代码段中提到的脚本是here

我尝试在chrome中运行它,虽然在Internet Explorer中运行该文件然后只是像鸭子一样坐在那里,但是它没有用。但

我非常感谢任何领导,建议或方法来做这件事。

谢谢!

0 个答案:

没有答案