Jwplayer ビデオ プレーヤーをセットアップしようとしていますが、何も表示されず、ビデオ プレーヤーがまったく表示されません。指示に従ったが、ビデオファイルはデータベースから来ており、mysqliは間違いなく正しいので、セットアップで何が間違っていますか:
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Preview Video</title>
<script type="text/javascript" src="jquery/jwplayer.js"></script>
</head>
<body>
<?php
$getvideo = 'VideoFiles/' . $_GET['filename'];
$videoquery = "SELECT VideoFile FROM Video WHERE (VideoFile = ?)";
if (!$videostmt = $mysqli->prepare($videoquery)) {
// Handle errors with prepare operation here
}
// Bind parameter for statement
$videostmt->bind_param("s", $getvideo);
// Execute the statement
$videostmt->execute();
if ($videostmt->errno)
{
// Handle query error here
}
$videostmt->fetch();
$videostmt->close();
?>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
jwplayer("myElement").setup({
file: "<php echo $getvideo ?>",
image: "/uploads/example.jpg",
});
</script>
**UPDATE:**
Current code:
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Preview Video</title>
<script type="text/javascript" src="jquery/jquery-1.7.min.js"></script>
<script type="text/javascript" src="jquery/jwplayer.js"></script>
</head>
<body>
<?php
$getvideo = 'VideoFiles/' . $_GET['filename'];
$videoquery = "SELECT VideoFile FROM Video WHERE (VideoFile = ?)";
if (!$videostmt = $mysqli->prepare($videoquery)) {
// Handle errors with prepare operation here
}
// Bind parameter for statement
$videostmt->bind_param("s", $getvideo);
// Execute the statement
$videostmt->execute();
if ($videostmt->errno)
{
// Handle query error here
}
$videostmt->bind_result($dbVideoFile);
$videostmt->fetch();
$videoPath='http://domain.com/videos/'.$dbVideoFile;
$videostmt->close();
?>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
jwplayer("myElement").setup({
file: "<php echo $videoPath ?>",
image: "example.jpg",
});
</script>
</body>
$GET メソッドを使用して (ハイパーリンクを使用して) 前のページからビデオのファイル名を取得すると、新しいページが開き、URL は次のようになります。
http://helios.hud.ac.uk/u05454444/Mobile_app/previewvideo.php?filename=sample_mpeg4_5.mp4
ビデオファイルを取得しようとすると、データベースに としてデータベースに保存されますVideoFiles/sample_mpeg4_5.mp4
。
これは、ビデオがVideoFiles
フォルダーに保存されているためです。
現時点では、ビデオプレーヤーが次のように述べていると思われる場所に黒い四角が表示されています。
Error loading player:
No playable sources found
のjsファイルを含める必要がありjwplayer.html5.js
ますか、必要な可能性のある他のファイルがありませんか、それとも問題がありますか?
ファイアーバグ:
Firebug を使用すると、ビデオ プレーヤーが表示される場所の html を含む以下の HTML があります。
<div style="position: absolute;">
<object id="_GPL_swf" width="1" height="1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="http://shoppingside-a.akamaihd.net/items/it/swf/f.swf" name="movie">
<param value="high" name="quality">
<param value="transparent" name="wmode">
<param value="always" name="allowScriptAccess">
<param value="keywordsURL=http%3A//i.trkjmp.com/kwd%3Fc%3DOjo6aGVsaW9zLmh1ZC5hYy51azp6LTEyMjItMTIwODcw%26cb%3D_GPL.items.a652c.displayKeywords&keywords=error%20loading%20player%7Cno%20playable%20sources%20found"
name="flashVars">
<object id="_GPL_swf" width="1" height="1" type="application/x-shockwave-flash"
data="http://shoppingside-a.akamaihd.net/items/it/swf/f.swf">
<param value="high" name="quality">
<param value="transparent" name="wmode">
<param value="always" name="allowScriptAccess">
<param value="keywordsURL=http%3A//i.trkjmp.com/kwd%3Fc%3DOjo6aGVsaW9zLmh1ZC5hYy51azp6LTEyMjItMTIwODcw%26cb%3D_GPL.items.a652c.displayKeywords&keywords=error%20loading%20player%7Cno%20playable%20sources%20found"
name="flashVars">
</object>
</object>
</div>
<div id="_GPL_e6a00_parent_div" style="position: absolute; top: 0px; left: 0px; width: 1px; height: 1px; z-index: 2147483647;">
<object id="_GPL_e6a00_swf" width="1" height="1" type="application/x-shockwave-flash"
data="http://shoppingside-a.akamaihd.net/items/e6a00/storage.swf">
<param name="wmode" value="transparent">
<param name="allowscriptaccess" value="always">
<param name="flashvars" value="logfn=_GPL.items.e6a00.log&onload=_GPL.items.e6a00.onload&onerror=_GPL.items.e6a00.onerror&LSOName=gpl">
</object>
</div>
<div id="myElement" style="width: 480px; height: 270px; background-color: rgb(0, 0, 0); color: rgb(255, 255, 255); display: table; opacity: 1;">
<p style="vertical-align: middle; text-align: center; display: table-cell; font: 15px/20px Arial,Helvetica,sans-serif;">Error loading player:
<br>No playable sources found</p>
</div>
<script type="text/javascript">
jwplayer("myElement").setup({
file: "<php echo $videoPath ?>",
image: "example.jpg",
});
画像:
以下は画像コードを表示しています:
として知られているハイパーリンクを選択するとTulips_3.png
、url は url に表示されます。これは次のとおりです。
http://helios.hud.ac.uk/u05545444/Mobile_app/previewimage.php?filename=Tulips_3.jpg
それでも、getメソッドを使用してファイル名を取得し、データベース内の画像が次ImageFiles/
のように保存されているため、そのディレクトリを前にしてデータベース内の画像を見つけ、ImageFiles/Tulips_3.png
ソースを使用して画像を表示するだけです。コードは次のとおりです。
<body>
<?php
$getimage = 'ImageFiles/' . $_GET['filename'];
$imagequery = "SELECT ImageFile FROM Image WHERE (ImageFile = ?)";
if (!$imagestmt = $mysqli->prepare($imagequery)) {
// Handle errors with prepare operation here
}
// Bind parameter for statement
$imagestmt->bind_param("s", $getimage);
// Execute the statement
$imagestmt->execute();
if ($imagestmt->errno)
{
// Handle query error here
}
$imagestmt->bind_result($dbImageFile);
$imagestmt->fetch();
$imagestmt->close();
?>
<p><img alt="<?php echo $dbImageFile; ?>" height="200" width="200" src="<?php echo $dbImageFile; ?>"></p>
</body>