Код: Выделить всё
<div id="demo" class="player"></div>
<script>
$(document).ready(function() {
jwplayer('demo').setup({
file: encodeURIComponent('/video/out?alias=v1'),
provider: 'video',
write: 'mediaspace',
});
});
</script>
Код: Выделить всё
public function actionOut($alias)
{
if ( !self::checkAccess($filename) ) {
die("Access not available!");
}
$filename = self::getNameByAlias($alias);
$location = Yii::getPathOfAlias('webroot') . '/uploads/videos/' . $filename;
$ctype = "video/x-flv";
header("Content-type: " . $ctype);
header("Content-type: filename=" . $filename);
header("Cache-Control: no-cache, no-store, max-age=0, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Expires: Mon, 20 Dec 1980 00:00:00 GMT");
header("Pragma: no-cache");
header("Content-Transfer-Encoding: binary");
header("Content-Description: File Transfer");
@readfile($location) OR die("File not found.");
}
Если убрать в скрипте инициализации плеера encodeURIComponent то плеер выдает No playable sources found.
Уж и не знаю как исправить эту ситуацию. Может изначально задачу неправильно решаю? Заранее спасибо за комментарии!