Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在HTML中播放本地存储的FLV文件_Javascript_Html_Flv - Fatal编程技术网

Javascript 在HTML中播放本地存储的FLV文件

Javascript 在HTML中播放本地存储的FLV文件,javascript,html,flv,Javascript,Html,Flv,我正在尝试制作一个简单的html页面,您可以单击一个按钮,它会播放本地存储在我的计算机上的FLV文件,但我不确定我做错了什么。我已经在Youtube视频和MP4上做了类似的事情,但是我在播放FLV文件时遇到了麻烦。我所做的最好的事情就是,当它被点击时,它就会被下载。这是我的密码: <html> <body> <video id = "video" width = "200px" height = "200px"> </video> &

我正在尝试制作一个简单的html页面,您可以单击一个按钮,它会播放本地存储在我的计算机上的FLV文件,但我不确定我做错了什么。我已经在Youtube视频和MP4上做了类似的事情,但是我在播放FLV文件时遇到了麻烦。我所做的最好的事情就是,当它被点击时,它就会被下载。这是我的密码:

<html>
<body>
  <video id = "video" width = "200px" height = "200px">
  </video>

  <iframe id = "YouTube" width="560" height="315" frameborder="0" allowfullscreen>
  </iframe>

  <embed id = "flash" width = "200px" height = "200px">
  </embed>

  <button id = "playVideo">Play Short Clip</button>
  <button id = "playYouTube">Play YouTube Video</button>
  <button id = "playFlash">Play Flash</button>

</body>
<script>
document.getElementById("playVideo").onclick = function playVideo() {
  document.getElementById("video").setAttribute("src", "StarContainerTunnel.mp4");
  document.getElementById("video").play();
};
document.getElementById("playYouTube").onclick = function playYouTube() {
  document.getElementById("YouTube").setAttribute("src", "https://www.youtube.com/embed/DTqa-NEwUbs");
  document.getElementById("YouTube").play();
};
document.getElementById("playFlash").onclick = function playFlash() {
  document.getElementById("flash").setAttribute("src", "barsandtone.flv");
  document.getElementById("flash").play();
};
</script>

</html>

播放短片
播放YouTube视频
播放闪光灯
document.getElementById(“playVideo”).onclick=函数playVideo(){
document.getElementById(“video”).setAttribute(“src”、“StarContainerTunnel.mp4”);
document.getElementById(“视频”).play();
};
document.getElementById(“playYouTube”).onclick=函数playYouTube(){
document.getElementById(“YouTube”).setAttribute(“src”),“https://www.youtube.com/embed/DTqa-NEwUbs");
document.getElementById(“YouTube”).play();
};
document.getElementById(“playFlash”).onclick=函数playFlash(){
document.getElementById(“flash”).setAttribute(“src”、“barsandtone.flv”);
document.getElementById(“flash”).play();
};

看起来这个问题在这里得到了回答:

你可以用它来实现你的目标

一旦你得到这个,你可以像这样使用视频标签:

<video id="example_video_1" class="video-js vjs-default-skin"
 controls preload="auto" width="640" height="480"
 poster="http://video-js.zencoder.com/oceans-clip.png"
 data-setup='{"example_option":true}'>
<source src="rtmp://localhost/live/test" type="rtmp/flv">
</video>

看起来这个问题在这里得到了回答:

你可以用它来实现你的目标

一旦你得到这个,你可以像这样使用视频标签:

<video id="example_video_1" class="video-js vjs-default-skin"
 controls preload="auto" width="640" height="480"
 poster="http://video-js.zencoder.com/oceans-clip.png"
 data-setup='{"example_option":true}'>
<source src="rtmp://localhost/live/test" type="rtmp/flv">
</video>


<>代码>当您将AbjtNealMe=属性值与空格分开时,大多数浏览器会将其视为节点的三种不同属性。代码>
=>将是节点:按钮,属性
'id'=null
'='=null
'playVideo'=null
。对于您的问题,flv需要一个播放器。不能直接将flv文件作为嵌入对象播放。看看是否解决了这个问题?当你将AbjtNealMe=属性值与空格分开时,大多数浏览器会将其视为节点的三种不同属性。代码>=>将是节点:按钮,属性
'id'=null
'='=null
'playVideo'=null
。对于您的问题,flv需要一个播放器。不能直接将flv文件作为嵌入对象播放。看一看可能的重复,这是否解决了?这是否也适用于SWF文件?我也在尝试实现一个SWF文件,但它似乎不起作用。您应该能够像这样添加SWF文件:
可以为param标记设置属性吗?因为我尝试使用getElementsByName(“movie”).setAttribute(“value”,“somefilename.swf”);因此,与我的其余代码类似,当我单击play flash按钮时,它将播放swf文件。这是否也适用于swf文件?我也在尝试实现一个SWF文件,但它似乎不起作用。您应该能够像这样添加SWF文件:
可以为param标记设置属性吗?因为我尝试使用getElementsByName(“movie”).setAttribute(“value”,“somefilename.swf”);因此,与我的代码的其余部分类似,当我单击play flash按钮时,它将播放swf文件。