I've got a ShoutCAST stream and decided to give JPlayer a try. I've researched as much as I can on my on, but still can not seem to get it to work and I am not getting any error messages. My code is as follows:
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
mp3: "http://67.205.95.146:8068/;stream/1"
}).jPlayer("play");
},
swfPath: "http://www.fightfansradio.com/wp-content/themes/FFR2/js/Jplayer.swf",
supplied: "mp3",
wmode: "window"
});
});
//]]>
</script>
I have an absolute path the SWF file
I double checked my encoding and it is indeed MP3
Again, I'm not getting any error messages
The player doesn't seem to work at all as if it can't find the stream
I feel like I did quite a bit of research trying to solve this issue myself, so any help would be greatly appreciated.
I used this below Coding for Live streaming, it plays on in the primcast.com website.
<script type="text/javascript" src="http://www.primcast.com/jwplayer/swfobject.js"></script>
<div id="player_preview" style="float:left;">
This text will be replaced. Streaming solutions by
Primcast - Shoutcast hosting, Flash Streaming
</div>
<script type="text/javascript">
var so = new SWFObject('http://www.primcast.com/jwplayer/mediaplayer.swf','mpl',560,20,'9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&autostart=true&duration=-1&file=http://93.91.197.214:1234/;stream.nsv');
so.write('player_preview')
</script>
This reply might be late. If you are trying to play the audio in Android, remove
.jPlayer("play"). For some reason Android does not like auto-play.
Related
I am working on a project which needs to play MPEG-DASH stream playback on top of videojs.
Now the playback of the stream stops playing after 59 seconds.
See below code and error i am getting
<video id="example-video">
<source src="http://hitsradio.videocdn.scaleengine.net/ondemand/play/mp4:sestore8/hitsradio/ZZ Top - Cheap Sunglasses.mp4/manifest.mpd" type="application/dash+xml">
</video>
<script src="path/to/video.js">
<script src="path/to/videojs-dash.js"></script>
<script src="path/to/dash.all.js"></script>
<script>
myPlayer = document.getElementById("example-video");
myPlayer.play()
</script>
Now the error i got in browsers
[60269][bufferController][video] Waiting for more buffer before starting playback.
dash.all.js:11 [60271][scheduleController][audio] Stalling Buffer
dash.all.js:11 [60271][bufferController][audio] Waiting for more buffer before starting playback.
dash.all.js:11 [60272][playbackController] <video> ratechange: 0
This seems to be a bug in video.js. I just tested other web-based players like dash.js, bitmovin's adaptive streaming player and Google's Shaka player and all three of them played the stream without problems.
To the best of my knowledge, video.js uses dash.js for MPEG-DASH playback, so either you're using an old dash.js version (I tested the latest v2.0.0) or there is a problem in the video.js DASH plugin. If the later is the problem you should create an issue in their github repository.
I am a jQuery user and just learning YUI. I have the following code and I keep the error that YUI is not defined. I know it is an issue with linking to the library but I'm not exactly sure what. I had someone else test my code where they had YUI held locally and it worked fine. If I need to do this, how do I obtain a copy of the min.js file? When you download a copy from the YUI site its a tonne of files...
<head>
<title>YUI3 Test</title
<script src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
</head>
<body>
<div id="menu">
<p>Click here to test.</p>
</div>
<script>
YUI().use('node', 'event', function (Y){
var changeText = function(e){
e.target.setHTML("<p>Now you see the test working.</p>");
}
var node = Y.one("#menu");
node.on("click", changeText);
//node.on("click", function(e){
// Y.one(node).load('menu.html');
//});
});
</script>
</body>
Thanks!
You're missing a > after </title. This may be causing the script tag not to be recognized and so it's not loading.
Here it is broken: http://jsbin.com/ubaxoy/1/edit
And here it works after adding the missing >: http://jsbin.com/ubaxoy/2/edit
I also had to change setHTML to setContent because YUI 3.2 didn't have setHTML yet. I'd also recommend you to use a newer version of YUI, from 3.9.1 up. There have been a number of great additions since 3.2.
In the tutorial for migrating a Google Chrome Extension to Manifest Version 2, I am directed to Remove inline event handlers (like onclick, etc) from the HTML code, move them into an external JS file and use addEventListener() instead.
OK, I currently have a background.html page that looks like this…
<html>
<script type="text/javascript">
// Lots of script code here, snipped
…
</script>
<body onload="checkInMyNPAPIPlugin('pluginId');">
<object type="application/x-mynpapiplugin" id="pluginId">
</body>
</html>
Following another directive, I've moved that Lots of script code into a separate .js file, and following this directive, I need to remove the onload= from the body tag, and instead cal addEventListener() in my script code. I've tried several approaches, but am apparently guessing wrong. What will that code look like? In particular, upon what object do I invoke addEventListener()?
Thanks!
I normally use this for body onload event...
document.addEventListener('DOMContentLoaded', function () {
// My code here.. ( Your code here )
});
For somethings it is working.. but really, I think we should use..
window.addEventListener('load', function () {
document.getElementById("#Our_DOM_Element").addEventListener('change - or - click..', function(){
// code..
});
});
I'm about to create my first Chrome extension (it's a Popup), it'll POST data to a server.
Thought it would be easy, but I get stuck.
in manifest.json I set permissions for "http://mypage[dot]com/" and also "http://mypage[dot]com/*" so that I can access the "mypage[dot]com/api" where the data has to be sent to.
And so my popup.html looks like:
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<title>myExtension</title>
</head>
<body>
<form name="myform">
<input type="text" name="myText" id="myText"/>
<input type="submit" name="senden"/>
</form>
</body>
<script src="jquery-1.8.2.min.js"></script>
<script src="popup.js"></script>
</html>
And so my popup.js looks like:
document.forms["myForm"].addEventListener("submit", sendRequest)
function sendRequest() {
var myVar= $('#mytext').val();
var myrequest= $.ajax({
type: 'POST',
url: 'http://mypage.com/api/',
data: {screen_name: 'myname', api_key: 'myKey', var1: myVar},
success: function(data, textStatus){
alert('request successful');
},
error: function(xhr, textStatus, errorThrown){
alert(xhr); alert(textstatus); alert(errorThrown);
}
});
}
Now, when I hit the submit-button it'll give me only these three alerts, the first one says: [object Object], the second one: error and the third one is only empty.
I tried to solve this problem but I dont know where the error is. Also I read about some background.html and content_script.js but I dont know what I have to do with them and some extensions, I found in the internet, only contain the popup.html and popup.js and they work as fine as they should do (e.g. the domai.nr-extension).
So I'd very happy about some explanations what I have to use and to do to post data correctly within a popup extension.
first, you close the head tag but dont open it
try to give your form an id like
<form id="myform">
then i would simplify the js code like this
$('#myform').submit(function(){
var myVar= $('#mytext').val();
$.ajax({
url: "http://mypage.com/api/",
type: "POST",
data: {screen_name: 'myname', api_key: 'myKey', var1: myVar},
success: function(data, textStatus){
alert('request successful');
},
error: function(xhr, textStatus, errorThrown){
alert(xhr); alert(textstatus); alert(errorThrown);
}
});
});
Issue
If you want to make a Cross-Origin ajax call, you need to request appropriate permissions.
Debugging
Better way to debug variables than alert() is console.log(). To see the output of this method you need to open a console. To open a console for a popup: open a popup, right click on it and choose 'inspect element'. When Developer Tools will open, navigate to 'Console' tab. You will get much more information from console.log(xhr) than from alert(xhr). In addition all permission warnings, invalid syntax warnings etc. are printed out on console making it easy to find a bug.
AJAX from popup
Sending a POST request from a popup has a one week point: when popup is closed (and it's closed very easily - when user clicks something outside the popup) the request is canceled. And here comes the background page you mentioned. Background page works in (surprise, surprise) background and can't be easily closed. Your popup should communicate with background page and ask it to make an ajax call. If you do that, background page will perform AJAX call even though popup may be already closed.
Check your function in http://mypage.com/api/.
test it by write simple response like that:
function nameOfFunciton(){
echo "test";
}
If you see "request successful" alert, thus the problem exist in your code.
How must the code below be changed to embed this YouTube with sound off?
<embed src="http://www.youtube.com/v/etnh6_omu0w&hl&rel=1&autoplay=1&sound=1" type="application/x-shockwave-flash"
allowscriptaccess="always" allowfullscreen="true" width="200"></embed>
Here's the code as it should be:
you'll need to include this as well in the same folder this code is in:
SWFObject.js
That's just some helper code, I wouldn't worry about it.
code:
<script type="text/javascript" src="swfobject.js"></script>
<div id="ytapiplayer">
You need Flash player 8+ and JavaScript enabled to view this video.
</div>
<script type="text/javascript">
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer" };
swfobject.embedSWF("http://www.youtube.com/v/FSz_a_yx9hA&hl&enablejsapi=1&playerapiid=ytplayer",
"ytapiplayer", "425", "356", "8", null, null, params, atts);
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
ytplayer.mute();
}
</script>
Ok I tested that code and I know it works so if you have any problems let me know, happy hacking!
Get the docs here: YouTube Embedded Player Javascript API Reference
It doesn't work in my web browsers. It said my flash player should be version 8+ But I was using flash player 9 with javascript on. I tested on both Firefox 3.11 & IE 7.
I realize, the flash player's support on Firefox is a little bit buggy (update the player several times), some flash movie may still not appear (blank), but on IE it should work fine. But not in your sample code..
Correction: it works on my IE 7.
But not in Firefox 3.11. I wonder, why flash player / SWFObject not getting along with recent firefox. Do you have any tweak or recommendation can be done to make Firefox 3 plays all swf well?
There might be a volume parameter on the embed tag:
Link