JavaScript - прописывание пути в блоке.

Главные вкладки

Аватар пользователя DreamPower DreamPower 26 октября 2013 в 13:29

Скачал демо с сайта джиплеера, изменил под свой поток, заработало.

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />

<!-- Website Design By: www.happyworm.com -->
<title>Demo : jPlayer as an audio live-stream player</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
<script type="text/javascript">
<![CDATA[
$(document).ready(function(){

        var stream = {
                title: "My stream",
                mp3: "http://localhost:8000/mystream"
        },
        ready = false;

        $("#jquery_jplayer_1").jPlayer({
                ready: function (event) {
                        ready = true;
                        $(this).jPlayer("setMedia", stream);
                },
                pause: function() {
                        $(this).jPlayer("clearMedia");
                },
                error: function(event) {
                        if(ready && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) {
                                // Setup the media stream again and play it.
                                $(this).jPlayer("setMedia", stream).jPlayer("play");
                        }
                },
                swfPath: "js",
                supplied: "mp3",
                preload: "none",
                wmode: "window",
                keyEnabled: true
        });

});
]]>
</script>
</head>
<body>

                <div id="jquery_jplayer_1" class="jp-jplayer"></div>

                <div id="jp_container_1" class="jp-audio-stream">
                        <div class="jp-type-single">
                                <div class="jp-gui jp-interface">
                                        <ul class="jp-controls">
                                                <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
                                                <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
                                                <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
                                                <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
                                                <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
                                        </ul>
                                        <div class="jp-volume-bar">
                                                <div class="jp-volume-bar-value"></div>
                                        </div>
                                </div>
                                <div class="jp-title">
                                        <ul>
                                                <li>My stream</li>
                                        </ul>
                                </div>
                                <div class="jp-no-solution">
                                        <span>Update Required</span>
                                        To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
                                </div>
                        </div>
                </div>
</body>

</html>

Потом попытался добавить в блок это демо, вроде как поправив пути, вылезает ошибка при нажатии play допустим:
Page not found
The requested page "/drupoffic/;" could not be found.

Моя версия, которую пытаюсь добавить в блок:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />

<!-- Website Design By: www.happyworm.com -->
<title>Demo : jPlayer as an audio live-stream player</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="drupoffic/sites/all/libraries/skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="drupoffic/sites/all/libraries/jplayer/jquery.jplayer.min.js"></script>
<script type="text/javascript">
<![CDATA[
$(document).ready(function(){

        var stream = {
                title: "My stream",
                mp3: "http://localhost:8000/mystream"
        },
        ready = false;

        $("#jquery_jplayer_1").jPlayer({
                ready: function (event) {
                        ready = true;
                        $(this).jPlayer("setMedia", stream);
                },
                pause: function() {
                        $(this).jPlayer("clearMedia");
                },
                error: function(event) {
                        if(ready && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) {
                                // Setup the media stream again and play it.
                                $(this).jPlayer("setMedia", stream).jPlayer("play");
                        }
                },
                swfPath: "drupoffic/sites/all/libraries/jplayer",
                supplied: "mp3",
                preload: "none",
                wmode: "window",
                keyEnabled: true
        });

});
]]>
</script>
</head>
<body>

                <div id="jquery_jplayer_1" class="jp-jplayer"></div>

                <div id="jp_container_1" class="jp-audio-stream">
                        <div class="jp-type-single">
                                <div class="jp-gui jp-interface">
                                        <ul class="jp-controls">
                                                <li><a href="drupoffic\sites\all\libraries\jplayer\javascript:;" class="jp-play" tabindex="1">play</a></li>
                                                <li><a href="drupoffic\sites\all\libraries\jplayer\javascript:;" class="jp-pause" tabindex="1">pause</a></li>
                                                <li><a href="drupoffic\sites\all\libraries\jplayer\javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
                                                <li><a href="drupoffic\sites\all\libraries\jplayer\javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
                                                <li><a href="drupoffic\sites\all\libraries\jplayer\javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
                                        </ul>
                                        <div class="jp-volume-bar">
                                                <div class="jp-volume-bar-value"></div>
                                        </div>
                                </div>
                                <div class="jp-title">
                                        <ul>
                                                <li>My stream</li>
                                        </ul>
                                </div>
                                <div class="jp-no-solution">
                                        <span>Update Required</span>
                                        To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
                                </div>
                        </div>
                </div>
</body>

</html>

Соответственно, последняя версия не работает. Подскажите, в чем может быть проблема\как прописывать путь? З.Ы. Джаваскрипт разрешен.

Комментарии

Аватар пользователя DreamPower DreamPower 26 октября 2013 в 13:46

Поправил слеши, правильный вариант "sites/all/libraries/jplayer/javascript:;"
Видимо, я ошибался, что джаваскрипт разрешен. В чем может быть проблема?
Forbidden

You don't have permission to access /drupoffic/sites/all/libraries/jplayer/javascript:; on this server.