APIM manage workflow with multiple roles APIM 3.0.0 per API based subscription workflow Logging internal HTTP requests Log APIM analytics events to a file Monetization and sample with WSO2 API Manager 2.6.0 Share application and subscription among a set of specific groups or roles WSO2 APIM Correlating analytics event with correlationID APIM analytics distinguish production and sandbox traffic APIM 2.x.x analytics internal and analytics tuneup Configure APIM(Next release) Key Manager User stores APIM(Next release) working with key manager DAS 3.x Parse system variables to Spark Context Revoke OAuth application In APIM 2.1.0 Next WSO2 APIM powered by WSO2 Ballerina Configure WSO2 APIM Analytics on Cluster environment Configure WSO2 DAS 3.1.0 for WSO2 APIM 2.0.0 Analytics WSO2 APIM publishing custom statistics WSO2 APIM Error codes Working with WSO2 message tracer Use DAS admin service to query using Spark SQL Configure WSO2 APIM Analytics using XML WSO2 APIM Generating and Retrieving Custom Statistics Understanding WSO2 APIM Statistics Model Publishing WSO2 APIM 1.10.x Runtime Statistics to DAS with RDBMS Publishing_APIM_1100_Runtime_Statistics_to_DAS Aggregate functions with WSO2 DAS REST API Create a cApp for WSO2 DAS Debugging WSO2 Products using OSGI console. Publishing APIM Runtime Statistics to DAS Deploy cApp on WSO2 DAS How to configure and start the Accumulo minicluster How to setup DNS server on Ubuntu and Ubuntu server How to use Java Reflection how to install apache web server on ubuntu and ubuntu server How to install Mail server on Ubuntu and Ubuntu server How to install squirrelmail webmail client on Ubuntu and Ubuntu Server Pass and return String value to JNI method Pass and return numeric value to JNI method Calling a C Function from the Java Programming Language using JNI AXIS 2 Sample web service Client with maven and eclipse How to setup AXIS 2 with Apache Tomcat AXIS 2 Sample web service with maven and eclipse Robot framework Sample with Selenium Robot framework Custom Library Sample Behaviour-Driven Development with JBehave and Eclipse Play Audio with Netbeans and linking with LibVLC Implement LibVLC based player with QT-part2 Simple Audio playing sample with LibVLC How to install LibVLC on Ubuntu Implement LibVLC based player with QT-part1
Play Audio with Netbeans and linking with LibVLC

In this blog i will demonstrate how to play mp3 file using simple LibVLC and Neatbeans on ubuntu.

  1. First you need to install LibVLC into your system. if you not, follow how to install tutorial to install LibVLC.
  2. Open Netbeans and create new C application.

    after project create, main file looks like this.

  3. Replace this main.c file with below content.
                #include ‹stdio.h›
                #include ‹stdlib.h›
                #include ‹vlc/vlc.h›
    
                int main(int argc, char **argv)
                {
                    libvlc_instance_t *inst;
                    libvlc_media_player_t *mp;
                    libvlc_media_t *m;
    
                    // load the vlc engine
                    inst = libvlc_new(0, NULL);
    
                    // create a new item
                    m = libvlc_media_new_path(inst, "/home/audio.mp3");
    
                    // create a media play playing environment
                    mp = libvlc_media_player_new_from_media(m);
    
                    // no need to keep the media now
                    libvlc_media_release(m);
    
                    // play the media_player
                    libvlc_media_player_play(mp);
    
                    sleep(100);//play the audio 100s
    
                    // stop playing
                    libvlc_media_player_stop(mp);
    
                    // free the media_player
                    libvlc_media_player_release(mp);
    
                    libvlc_release(inst);
    
    
                    return 0;
                }
            
  4. You need place mp3 file named audio.mp3 in your home directory.
  5. Try to run the project by clicking the Netbeans Run button.
    • But you will get this kind of error. It is because Project must be link to the LibVLC in netbeans.
                      /home/rukshan/NetBeansProjects/Audio/main.c:19: undefined reference to `libvlc_new'
                      /home/rukshan/NetBeansProjects/Audio/main.c:22: undefined reference to `libvlc_media_new_path'
                      /home/rukshan/NetBeansProjects/Audio/main.c:25: undefined reference to `libvlc_media_player_new_from_media'
                      /home/rukshan/NetBeansProjects/Audio/main.c:28: undefined reference to `libvlc_media_release'
                      /home/rukshan/NetBeansProjects/Audio/main.c:31: undefined reference to `libvlc_media_player_play'
                      /home/rukshan/NetBeansProjects/Audio/main.c:42: undefined reference to `libvlc_media_player_stop'
                      /home/rukshan/NetBeansProjects/Audio/main.c:45: undefined reference to `libvlc_media_player_release'
                      /home/rukshan/NetBeansProjects/Audio/main.c:47: undefined reference to `libvlc_release'
                      collect2: ld returned 1 exit status
                      make[2]: *** [dist/Debug/GNU-Linux-x86/audio] Error 1
                      make[1]: *** [.build-conf] Error 2
                      make: *** [.build-impl] Error 2
                      BUILD FAILED (exit value 2, total time: 144ms)
                
    • To link it to the LibVLC follow the steps.
        • right click on the project Audio and select properties.
        • Select Linker menu from left pane.
        • Click the browse button right to the Libraries from the right pane.
        • from the poped window choose the usr/lib/libvlc.so by clicking add library.
      • Clicking ok exit from the windows.
  6. Run the project by clicking the Netbeans Run button again.
  7. Audio projct will run succesfully.

Add Comment

* Required information
1000
Powered by Commentics

Comments (0)

No comments yet. Be the first!