Recherche avancée

Médias (91)

Autres articles (101)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

Sur d’autres sites (10696)

  • How can a desktop node.js app play audio that may be controlled by the user like a media player ? [closed]

    19 février, par eedefeed

    I'm building a playlist manager that plays music. How can Node.JS play audio files quickly, reliably and with all the basic level features you would expect from a media player, namely :

    


      

    • play
    • 


    • pause
    • 


    • seek
    • 


    • stop
    • 


    • adjust volume
    • 


    


    I'm targetting windows/linux, but a Windows-only solution but be okay (for now.)

    


    I have tried a number of libraries and methods to play audio but it seems none of them are good enough :

    


      

    • Audic : it's reasonably good, but buggy. The play and pause functions sometimes get switched around. I also recall that there are some issues with uncaught exceptions somewhere in the dependencies that crash the entire app.
    • 


    • OBS : since the app is designed with broadcasting in mind, I've tried to use OBS's API to get it to play media. Unfortunately, it sometimes stops playback during some tracks, which is surprising since its underlying library, FFmpeg, plays them without issue.
    • 


    • node-groove : seems like its underlying library, libgroove, only supports linux. I can't find any builds to download, regardless.
    • 


    


    Attempts to use Speaker (which seems pretty good) have also failed because all the decoders have big issues :

    


      

    • Anything using lame - I want support for all audio, not specific formats.
    • 


    • fluent-FFmpeg - this is a wrapper around FFmpeg's CLI interface. It has no play/pause function, but bonus library fluent-FFmpeg-util adds this feature. Unfortunately, its pause takes about 4 seconds to work, which I'm guessing is to do with a buffer being exhausted. This is just too latent. Seek would also work by stopping the CLI process and reloading the file, which seems massively inefficient.
    • 


    • Node Vlc - promising but ancient library that gives me reams of node-gyp errors on install. Poorly documented and no explanation of what the library to do
    • 


    • VLC Client - this library has uncaught exceptions that crash the app. Wrapping in try/catch doesn't help.
    • 


    • sound play - doesn't support play/pause
    • 


    


    NPM's search function is filled with audio players designed to work in browsers, but I'm not building a web app. I guess it's an option but it seems inelegant to the point of rediculous.

    


    So it seems the best option centres around FFmpeg. FFmpeg has libraries, and I'm aware that node has ways to hook into those libraries via some sort of C or C++ compatibility layer. Unfortunately, official documentation is rather dense. Different unofficial guides seem to be recommending conflicting approaches (and might be dated), and it's difficult to work out whether myriad technologies are working in tandem or are alternatives, renames or replacements : node-gyp, node-api, addons, windows-build-tools, nan, C vs C++, Visual Studio. It's difficult to make any decisions or know where to start.

    


    Perhaps, also, another option is to use a Python library to interact with FFmpeg, since initial searches have indicated this might be possible. I wouldn't know whether this is a good option.

    


    So my question is : what's my best option to play audio ? Is it another NPM module that I'm not aware of ? Is it a compatibility layer with FFmpeg libraries ?

    


  • rtsp feed fails intermittently using node js

    7 mars, par Prem Kumar

    I am new to node.js and was debugging a code written by another developer. We have a an IP camera which provides rtsp feed which is being displayed on a webpage. I can view the camera feed using the rtsp url in VLC but the web viewer of camera feed usually gives white screen although it somehow works intermittently.

    


    I was told that it used to work properly when the machine was on Ubuntu 20.04 now it has been updated to Ubuntu 24.

    


    Index.js

    


    const Stream = require("node-rtsp-stream-jsmpeg");
const fs = require("fs");
const https = require("https");

const httpsServer = https.createServer({
  key: fs.readFileSync("./cert/ssl.key"),
  cert: fs.readFileSync("./cert/ssl.crt"),
});


const options = {
    name: "streamName",
    url: "rtsp://10.20.xxx.xx/profile1",
    wsPort: 3333,
    httpsServer: httpsServer
};

let stream = new Stream(options);
stream.start();


    


    index.html

    


    &#xA;&#xA;  &#xA;  &#xA;  &#xA;  <code class="echappe-js">&lt;script src=&quot;https://jsmpeg.com/jsmpeg.min.js&quot;&gt;&lt;/script&gt;&#xA;&#xA;&#xA;  
    &#xA; &#xA; &#xA;

    &#xA;&#xA; &lt;script type=&quot;text/javascript&quot;&gt;&amp;#xA;  var url = &quot;ws://localhost:3333&quot;;&amp;#xA;  var canvas = document.getElementById(&amp;#x27;video-canvas&amp;#x27;);&amp;#xA;  var player = new JSMpeg.Player(url, {canvas: canvas});&amp;#xA;  &lt;/script&gt;&#xA;&#xA;

    &#xA;

    I tried reinstalling the node modules but it didn't make any difference.&#xA;I am sure that there is no hardware issue as rtsp connection always works in VLC.

    &#xA;

    Following is the console log when it failsConsole Log for failure&#xA;Following is the console log when it worksConsole Log for success

    &#xA;

  • Pointer peril

    18 octobre 2011, par Mans — Bugs, Optimisation

    Use of pointers in the C programming language is subject to a number of constraints, violation of which results in the dreaded undefined behaviour. If a situation with undefined behaviour occurs, anything is permitted to happen. The program may produce unexpected results, crash, or demons may fly out of the user’s nose.

    Some of these rules concern pointer arithmetic, addition and subtraction in which one or both operands are pointers. The C99 specification spells it out in section 6.5.6 :

    When an expression that has integer type is added to or subtracted from a pointer, the result has the type of the pointer operand. […] If both the pointer operand and the result point to elements of the same array object, or one past the last element of the array object, the evaluation shall not produce an overflow ; otherwise, the behavior is undefined. […]

    When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object ; the result is the difference of the subscripts of the two array elements.

    In simpler, if less accurate, terms, operands and results of pointer arithmetic must be within the same array object. If not, anything can happen.

    To see some of this undefined behaviour in action, consider the following example.

    #include <stdio.h>
    

    int foo(void)

    int a, b ;
    int d = &b - &a ; /* undefined */
    int *p = &a ;
    b = 0 ;
    p[d] = 1 ; /* undefined */
    return b ;

    int main(void)

    printf("%d\n", foo()) ;
    return 0 ;

    This program breaks the above rules twice. Firstly, the &a - &b calculation is undefined because the pointers being subtracted do not point to elements of the same array. Most compilers will nonetheless evaluate this to the distance between the two variables on the stack. Secondly, accessing p[d] is undefined because p and p + d do not point to elements of the same array (unless the result of the first undefined expression happened to be zero).

    It might be tempting to assume that on a modern system with a single, flat address space, these operations would result in the intuitively obvious outcomes, ultimately setting b to the value 1 and returning this same value. However, undefined is undefined, and the compiler is free to do whatever it wants :

    $ gcc -O undef.c
    $ ./a.out
    0

    Even on a perfectly normal system, compiled with optimisation enabled the program behaves as though the write to p[d] were ignored. In fact, this is exactly what happened, as this test shows :

    $ gcc -O -fno-tree-pta undef.c
    $ ./a.out
    1

    Disabling the tree-pta optimisation in gcc gives us back the intuitive behaviour. PTA stands for points-to analysis, which means the compiler analyses which objects any pointers can validly access. In the example, the pointer p, having been set to &a cannot be used in a valid access to the variable b, a and b not being part of the same array. Between the assignment b = 0 and the return statement, no valid access to b takes place, whence the return value is derived to be zero. The entire function is, in fact, reduced to the assembly equivalent of a simple return 0 statement, all because we decided to violate a couple of language rules.

    While this example is obviously contrived for clarity, bugs rooted in these rules occur in real programs from time to time. My most recent encounter with one was in PARI/GP, where a somewhat more complicated incarnation of the example above can be found. Unfortunately, the maintainers of this program are not responsive to reports of such bad practices in their code :

    Undefined according to what rule ? The code is only requiring the adress space to be flat which is true on all supported platforms.

    The rule in question is, of course, the one quoted above. Since the standard makes no exception for flat address spaces, no such exception exists. Although the behaviour could be logically defined in this case, it is not, and all programs must still follow the rules. Filing bug reports against the compiler will not make them go away. As of this writing, the issue remains unresolved.