jplayer streaming stopping because no data for few second (or miliseconds) - vlc

i have vlc which stream mp3 to a icecast server.
when vlc has finished one file, it stops( --play-and-exit)
when the client is vlc, the stream keeps going.
if i use jplayer, it stops after the first song.
How can i make jplayer not timing out?
regards:
$(document).ready(function(){
var stream = {
title: "ABC Jazz",
oga: "http://streaming.yyy.com:8000/flux.ogg"
},
ready = false;
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
ready = true;
$(this).jPlayer("setMedia", stream);
},
pause: function() {
$(this).jPlayer("clearMedia");
},
error: function(event) {
$(this).jPlayer("setMedia", stream).jPlayer("play");
},
swfPath: "../js",
supplied: "oga",
preload: "none",
wmode: "window",
keyEnabled: true
});
$("#jplayer_inspector").jPlayerInspector({jPlayer:$("#jquery_jplayer_1")});
});

Related

Dropzone max file only one and remove the second file

I just use my code like this
Dropzone.options.attachkyc = {
maxFiles: 1,
accept: function(file, done) {
console.log("uploaded");
done();
},
init: function() {
this.on("maxfilesexceeded", function(file){
alert("No more files please!");
});
},
addRemoveLinks: true,
removedfile: function(file) {
var name = file.name;
$.ajax({
type: 'POST',
url: host+'upload/unfile',
data: "id="+name,
dataType: 'html'
});
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
//console.log();
}
};
When i upload second file is show alert "No more files please!", well is working taht file not uploaded, but my problem is, that second file i'm add it still show on my dropzone. My question is how i'm remove second file automaticly after i show the alert??
if you want to remove max file extended file you just have to use maxfilesexceeded method of dropzone
init: function() {
myDropzone.on("maxfilesexceeded", function (file) {
this.removeFile(file);
});
},
or you can also used one other method too
init: function() {
myDropzone.on("addedfile", function (file) {
if (myDropzone.files.length === 1) {
alert("You can Select upto 1 Pictures for Venue Profile.", "error");
this.removeFile(file);
}
});
},
I finaly sovle my problem.
on at
init: function() {
this.on("maxfilesexceeded", function(file){
alert("No more files please!");
});
},
i change it into like this
init: function() {
this.on("maxfilesexceeded", function(file){
alert("No more files please!");
this.removeFile(file);
});
},
is work perfectly i want.
If you are looking to keep the newly added file and remove the first file that was added you can do something like what is below:
init: function() {
myDropzone.on("maxfilesexceeded", function(file) {
this.removeFile(this.files[0]);
});
},
You could obviously update the index of this.files to access other files in the array as well.

JSPDF Gives Error to IE Object doesn't support this property or method

When i try to save the HTML in PDF it gives error line no 139 'jsPDFhtmlText' is undefined in IE where it runs fine with mozilla.
Can you please show your code. You will not be able to save the PDF in IE 8-9. You have to use downloadify pluggin given along with the JSPDF
Downloadify.create('downloadify',{
filename: 'Example.pdf',
data: function(){
var doc = new jsPDF();
doc.text(20, 20, 'PDF Generation using client-side Javascript');
doc.addPage();
doc.text(20, 20, 'Do you like that?');
return doc.output();
},
onComplete: function(){ alert('Your File Has Been Saved!'); },
onCancel: function(){ alert('You have cancelled the saving of this file.'); },
onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); },
swf: '../libs/downloadify/media/downloadify.swf',
downloadImage: '../libs/downloadify/images/download.png',
width: 100,
height: 30,
transparent: true,
append: false
});

VideoJS 4.0 Acts strangely on iPad

I was just upgrading my app to the new videojs version 4.0, but it is now not working for iPad (works on all other browsers as far as I can tell).
The 4.0 skin doesn't appear, and the API appears to not work at all. The video is being used as a background and is controlled by buttons in the app. However, after the upgrade, the video causes all of the buttons to become un-clickable (or un-touchable if you will).
Here's the JS I'm working with.
var $curTime = 0;
var $setPause = "Go";
var $timeOutTime = 1000;
$( '#main' ).on( 'pageshow',function(event){
videojs("HumanBody", {"preload":"metadata","poster":"http://pidcgr.com/lobby/humanbody/vid/poster.png","controls":true}, function(){
console.log("Initialized");
});
var myPlayer = videojs("HumanBody");
myPlayer.ready(function(){
myPlayer.src([
{ type: "video/mp4", src: "http://pidcgr.com/lobby/humanbody/vid/bodyapp.mp4" },
{ type: "video/ogg", src: "http://pidcgr.com/lobby/humanbody/vid/bodyapp.ogv" }
]);
setTimeout(function() {
if($setPause=="Paused") {
myPlayer.pause();
}
else {
myPlayer.play();
}
myPlayer.on('loadedmetadata', function() {
myPlayer.currentTime($curTime.toFixed(1));
});
}, $timeOutTime);
$(".video-nav").click(function() {
myPlayer.pause();
$curTime = myPlayer.currentTime();
$setPause = "Paused";
});
$("a.start-over").click(function() {
myPlayer.pause();
$curTime = 0;
$setPause = "Go";
});
myPlayer.on('pause', function() {
myPlayer.posterImage.show();
});
myPlayer.on('ended', function() {
myPlayer.currentTime(myPlayer.duration()-1+0.99);
myPlayer.pause();
myPlayer.posterImage.hide();
});
myPlayer.on('error', function() {
console.log("Error");
});
$timeOutTime = 500;
});
});
The video tag looks like this:
<video id="HumanBody" class="video-js vjs-default-skin" width="1024" height="748"></video>
Preview the URL here: http://pidcgr.com/lobby/humanbody/
There seems to be a new (not yet documented?) option you can set, that will disable default controls on iPad and Android devices and display the videojs skin:
customControlsOnMobile
So setup videojs with:
$( '#main' ).on( 'pageshow',function(event){
videojs("HumanBody", {"preload":"metadata","poster":"http://pidcgr.com/lobby/humanbody/vid/poster.png","controls":true, "customControlsOnMobile": true}, function(){
});
Greetings, Philip
that option has been changed to 'nativeControlsForTouch' in the latest version.
For someone trying to find customControlsOnMobile in source code.

Firefox addon progress listener

I am using this page to implement an address bar change listener.
https://developer.mozilla.org/en-US/docs/Code_snippets/Progress_Listeners#Example.3a_Notification_when_the_value_in_Address_Bar_changes
This code does what it is supposed to do. When I navigate to a new page, it alerts the URL. However, if the URL I have is 302 or similar it causes an issue. It will alert the redirected URL and not the original URL. I need the URL before the request is sent to the server and the redirect happens. Is this possible?
I think you can check this via the onStateChange event.
var myExtension = {
oldURL: null,
init: function() {
gBrowser.addProgressListener(this);
},
uninit: function() {
gBrowser.removeProgressListener(this);
},
processNewURL: function() {},
// nsIWebProgressListener
QueryInterface: XPCOMUtils.generateQI(["nsIWebProgressListener",
"nsISupportsWeakReference"]),
onLocationChange: function(aProgress, aRequest, aURI) {
this.processNewURL(aURI);
},
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
if (!aRequest) return;
if (aStateFlags & nsIWebProgressListener.STATE_START) {
alert(aRequest.name);
},
onProgressChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {}
};
window.addEventListener("load", function() { myExtension.init() }, false);
window.addEventListener("unload", function() { myExtension.uninit() }, false);
See more here: https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIRequest
aRequest is a nsIRequest, whose property name is the URL of the request.

Exiting full-screen at the end of a video with MediaElement.js

When using Safari on iOS I would like the video to come out of fullscreen mode at the end of the video.
I have added the following code to the body of my page but it doesn't fire. (the alert works when un-commented). Any suggestions? Thanks
<script>
new MediaElement('player1', {
success: function (mediaElement, domObject) {
// add event listener
mediaElement.addEventListener('ended', function(e) {
//Do Stuff here
//alert("sometext");
$('#player1').webkitExitFullScreen();
}, false);
},
});
</script>

Resources