Recherche avancée

Médias (0)

Mot : - Tags -/optimisation

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (52)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (7353)

  • Paperclip autoconvert GIF to MP4

    2 décembre 2014, par Mark Boulder

    I’m trying to autoconvert animated GIFs to MP4 using paperclip-ffmpegbut why are the newly created .flv files empty ?

    app/models/photo.rb

    class Photo < ActiveRecord::Base
     has_attached_file :attachment, :styles => {
       medium: {format: "flv"},
       thumbnail: {format: "png"}
     }, :processors => [:ffmpeg]

     belongs_to :post, class_name: "Forem::Post"

     validates_attachment :attachment, presence: true, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] }
    end

    config/environments/development.rb
    Paperclip.options[:command_path] = "/usr/bin/"

    Please try with this live app : http://runnable.com/VF91dsT_ufU_OLLG/rails-paperclip-gif-to-mp4

    Login : admin@example.com

    Password : admin1234

    Example GIF :

    enter image description here

    ffmpeg

    # ffmpeg
    ffmpeg version 0.8.7-6:0.8.7-1ubuntu2
    # which ffmpeg
    /usr/bin/ffmpeg

    Log

    # tail log/development.log
    Started POST "/default/topics" at 2014-12-02 06:47:58 +0000
    Processing by Forem::TopicsController#create as HTML
     Parameters: {"utf8"=>"✓", "authenticity_token"=>"8W8wk42e28JOUnUNvPjgfslVNV//aAmj4nxz/8dfqM0=", "topic"=>{"subject"=>"dfhfhdfhdfhdf", "posts_attribute
    s"=>{"0"=>{"text"=>"sdfsdfsdfsdf", "photos_attributes"=>{"0"=>{"attachment"=>#RackMultipart20141202-40-hqit2u>, @original_filename="gif.gif", @content_type="image/gif", @headers="Content-Disposition: form-data; name=\"topic[posts
    _attributes][0][photos_attributes][0][attachment]\"; filename=\"gif.gif\"\r\nContent-Type: image/gif\r\n">}}}}}, "commit"=>"Create Topic", "forum_id"=>"
    default"}
     User Load (0.3ms)  SELECT  "users".* FROM "users"  WHERE "users"."id" = 1  ORDER BY "users"."id" ASC LIMIT 1
     Forem::Forum Load (0.2ms)  SELECT  "forem_forums".* FROM "forem_forums"  WHERE "forem_forums"."slug" = 'default'  ORDER BY "forem_forums"."name" ASC L
    IMIT 1
     Forem::Category Load (0.1ms)  SELECT  "forem_categories".* FROM "forem_categories"  WHERE "forem_categories"."id" = ? LIMIT 1  [["id", 1]]
    Command :: file -b --mime '/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-17gal7n.gif'
    [paperclip] [ffmpeg] ffprobe "/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg1.gif" 2>&1
    [paperclip] [ffmpeg] Command Success
    [paperclip] [ffmpeg] Making...
    [paperclip] [ffmpeg] Building Destination File: 'd38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg1' + 'flv'
    [paperclip] [ffmpeg] Destination File Built
    [paperclip] [ffmpeg] Adding Geometry
    [paperclip] [ffmpeg] Adding Format
    [paperclip] [ffmpeg] Adding Source
    [paperclip] [ffmpeg] Building Parameters
    [paperclip] [ffmpeg] -i :source -y :dest
    Command :: ffmpeg -i '/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg1.gif' -y '/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg120141202
    -40-t4mbua.flv'
    Command :: file -b --mime '/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg120141202-40-t4mbua.flv'
    [paperclip] [ffmpeg] ffprobe "/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg1.gif" 2>&1
    [paperclip] [ffmpeg] Command Success
    [paperclip] [ffmpeg] Making...
    [paperclip] [ffmpeg] Building Destination File: 'd38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg1' + 'png'
    [paperclip] [ffmpeg] Destination File Built
    [paperclip] [ffmpeg] Adding Geometry
    [paperclip] [ffmpeg] Adding Format
    [paperclip] [ffmpeg] Adding Source
    [paperclip] [ffmpeg] Building Parameters
    [paperclip] [ffmpeg] -ss 3 -i :source -vframes 1 -f image2 -y :dest
    Command :: ffmpeg -ss 3 -i '/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-16dhhg1.gif' -vframes 1 -f image2 -y '/tmp/d38252762d3d4fd229faae637fd13f4e
    20141202-40-16dhhg120141202-40-1d5qljm.png'
      (0.2ms)  begin transaction
     Forem::Topic Exists (0.3ms)  SELECT  1 AS one FROM "forem_topics"  WHERE ("forem_topics"."id" IS NOT NULL) AND "forem_topics"."slug" = 'dfhfhdfhdfhdf'
    LIMIT 1
    Command :: file -b --mime '/tmp/d38252762d3d4fd229faae637fd13f4e20141202-40-zc9uyd.gif'
     SQL (0.7ms)  INSERT INTO "forem_topics" ("created_at", "forum_id", "slug", "subject", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?)  [["created_a
    t", "2014-12-02 06:47:59.655386"], ["forum_id", 1], ["slug", "dfhfhdfhdfhdf"], ["subject", "dfhfhdfhdfhdf"], ["updated_at", "2014-12-02 06:47:59.655386"
    ], ["user_id", 1]]
     SQL (0.3ms)  INSERT INTO "forem_posts" ("created_at", "text", "topic_id", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?)  [["created_at", "2014-12-02
    06:47:59.658316"], ["text", "sdfsdfsdfsdf"], ["topic_id", 24], ["updated_at", "2014-12-02 06:47:59.658316"], ["user_id", 1]]
     Forem::Topic Load (0.1ms)  SELECT  "forem_topics".* FROM "forem_topics"  WHERE "forem_topics"."id" = ? LIMIT 1  [["id", 24]]
     SQL (5.9ms)  UPDATE "forem_topics" SET "last_post_at" = '2014-12-02 06:47:59.658316' WHERE "forem_topics"."id" = 24
     Forem::Subscription Load (0.1ms)  SELECT  "forem_subscriptions".* FROM "forem_subscriptions"  WHERE "forem_subscriptions"."topic_id" = ?  ORDER BY "fo
    rem_subscriptions"."id" ASC LIMIT 1000  [["topic_id", 24]]
     SQL (0.1ms)  UPDATE "forem_posts" SET "notified" = 't' WHERE "forem_posts"."id" = 24
     SQL (0.1ms)  UPDATE "forem_posts" SET "state" = 'approved' WHERE "forem_posts"."id" = 24
    Binary data inserted for `string` type on column `attachment_content_type`
     SQL (0.2ms)  INSERT INTO "photos" ("attachment_content_type", "attachment_file_name", "attachment_file_size", "attachment_updated_at", "created_at", "
    post_id", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?)  [["attachment_content_type", "image/gif"], ["attachment_file_name", "gif.gif"], ["attachment_file_
    size", 1660134], ["attachment_updated_at", "2014-12-02 06:47:58.645579"], ["created_at", "2014-12-02 06:47:59.676633"], ["post_id", 24], ["updated_at",
    "2014-12-02 06:47:59.676633"]]
      (0.1ms)  SELECT COUNT(*) FROM "forem_subscriptions"  WHERE "forem_subscriptions"."topic_id" = ? AND "forem_subscriptions"."subscriber_id" = 1  [["top
    ic_id", 24]]
     SQL (0.1ms)  INSERT INTO "forem_subscriptions" ("subscriber_id", "topic_id") VALUES (?, ?)  [["subscriber_id", 1], ["topic_id", 24]]
     SQL (0.2ms)  UPDATE "forem_topics" SET "state" = 'approved' WHERE "forem_topics"."id" = 24
      (16.3ms)  commit transaction
    Redirected to http://web-fdf7b3ef-c097-41fe-ac7a-1cf06815fcbc.runnable.com/default/topics/dfhfhdfhdfhdf
    Completed 302 Found in 1114ms (ActiveRecord: 25.7ms)
  • FFMPEG not found because FFMPEG-binaries is no longer supported

    17 novembre 2019, par brenan patrick

    I have been attempting to create a Discord bot, but it cannot connect to a voice channel because it gives the errorError: FFMPEG not found. Is there a way to get around using FFMPEG-binaries or an older version that I can install manually ?

    const Discord = require('discord.js');
    const {
            prefix,
            token,
    } = require('./config.json');
    const ytdl = require('ytdl-core');

    const client = new Discord.Client();

    const queue = new Map();

    client.once('ready', () => {
            console.log('Ready!');
    });

    client.once('reconnecting', () => {
            console.log('Reconnecting!');
    });

    client.once('disconnect', () => {
            console.log('Disconnect!');
    });

    client.on('message', async message => {
            if (message.author.bot) return;
            if (!message.content.startsWith(prefix)) return;

            const serverQueue = queue.get(message.guild.id);

            if (message.content.startsWith(`${prefix}play`)) {
                    execute(message, serverQueue);
                    return;
            } else if (message.content.startsWith(`${prefix}skip`)) {
                    skip(message, serverQueue);
                    return;
            } else if (message.content.startsWith(`${prefix}stop`)) {
                    stop(message, serverQueue);
                    return;
            } else {
                    message.channel.send('You need to enter a valid command!')
            }
    });

    async function execute(message, serverQueue) {
            const args = message.content.split(' ');

            const voiceChannel = message.member.voiceChannel;
            if (!voiceChannel) return message.channel.send('You need to be in a voice channel to play music!');
            const permissions = voiceChannel.permissionsFor(message.client.user);
            if (!permissions.has('CONNECT') || !permissions.has('SPEAK')) {
                    return message.channel.send('I need the permissions to join and speak in your voice channel!');
            }

            const songInfo = await ytdl.getInfo(args[1]);
            const song = {
                    title: songInfo.title,
                    url: songInfo.video_url,
            };

            if (!serverQueue) {
                    const queueContruct = {
                            textChannel: message.channel,
                            voiceChannel: voiceChannel,
                            connection: null,
                            songs: [],
                            volume: 5,
                            playing: true,
                    };

                    queue.set(message.guild.id, queueContruct);

                    queueContruct.songs.push(song);

                    try {
                            var connection = await voiceChannel.join();
                            queueContruct.connection = connection;
                            play(message.guild, queueContruct.songs[0]);
                    } catch (err) {
                            console.log(err);
                            queue.delete(message.guild.id);
                            return message.channel.send(err);
                    }
            } else {
                    serverQueue.songs.push(song);
                    console.log(serverQueue.songs);
                    return message.channel.send(`${song.title} has been added to the queue!`);
            }

    }

    function skip(message, serverQueue) {
            if (!message.member.voiceChannel) return message.channel.send('You have to be in a voice channel to stop the music!');
            if (!serverQueue) return message.channel.send('There is no song that I could skip!');
            serverQueue.connection.dispatcher.end();
    }

    function stop(message, serverQueue) {
            if (!message.member.voiceChannel) return message.channel.send('You have to be in a voice channel to stop the music!');
            serverQueue.songs = [];
            serverQueue.connection.dispatcher.end();
    }

    function play(guild, song) {
            const serverQueue = queue.get(guild.id);

            if (!song) {
                    serverQueue.voiceChannel.leave();
                    queue.delete(guild.id);
                    return;
            }

            const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
                    .on('end', () => {
                            console.log('Music ended!');
                            serverQueue.songs.shift();
                            play(guild, serverQueue.songs[0]);
                    })
                    .on('error', error => {
                            console.error(error);
                    });
            dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
    }

    client.login(token);

    This is the error that appears after I attempt to ’ !play ’.

    D:\Bot-Files-Test>node index.js
    Ready!
    Error: FFMPEG not found
       at Function.selectFfmpegCommand (D:\Bot-Files-Test\node_modules\prism-media\src\transcoders\ffmpeg\Ffmpeg.js:46:13)
       at new FfmpegTranscoder (D:\Bot-Files-Test\node_modules\prism-media\src\transcoders\ffmpeg\Ffmpeg.js:7:37)
       at new MediaTranscoder (D:\Bot-Files-Test\node_modules\prism-media\src\transcoders\MediaTranscoder.js:10:19)
       at new Prism (D:\Bot-Files-Test\node_modules\prism-media\src\Prism.js:5:23)
       at new VoiceConnection (D:\Bot-Files-Test\node_modules\discord.js\src\client\voice\VoiceConnection.js:46:18)
       at D:\Bot-Files-Test\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:63:22
       at new Promise (<anonymous>)
       at ClientVoiceManager.joinChannel (D:\Bot-Files-Test\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:45:12)
       at VoiceChannel.join (D:\Bot-Files-Test\node_modules\discord.js\src\structures\VoiceChannel.js:130:30)
       at execute (D:\Bot-Files-Test\index.js:75:40)
    (node:9108) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
       at D:\Bot-Files-Test\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
       at D:\Bot-Files-Test\node_modules\snekfetch\src\index.js:215:21
       at runMicrotasks (<anonymous>)
       at processTicksAndRejections (internal/process/task_queues.js:93:5)
    (node:9108) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
    (node:9108) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.</anonymous></anonymous>
  • How to verify user permissions – Introducing the Piwik Platform

    9 novembre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to make your plugin multilingual). This time you’ll learn how to verify user permissions. For this tutorial you will need to have basic knowledge of PHP and the Piwik platform.

    When should a plugin verify permissions ?

    Usually you want to do this before executing any action – such as deleting or fetching data – and before rendering any sensitive information that should not be accessible by everyone. For instance in an API method or Controller action. You sometimes also need to verify permissions before registering menu items or widgets.

    How does Piwik’s user management work ?

    It is quite simple as it only differentiates between a few roles : View permission, Admin permission and Super User permission. If you manage multiple websites with Piwik a user can be assigned to different roles as a user might have no permission for some websites but view or admin permission for another set of websites.

    Worth mentioning is that roles inherit from each other. This means the role admin automatically includes the role view and a super user automatically covers the view and admin role.

    Getting started

    In this post, we assume that you have already set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.

    Verifying user permissions

    To protect your data the platform offers many convenient methods in the \Piwik\Piwik class. There you will find methods that either start with check, is or has. While methods that start with check throw an exception in case a condition is not met, the other methods return a boolean true or false.

    Use methods that throw an exception if you want to stop any further execution in case a user does not have an appropriate role. The platform will catch the exception and display an error message or ask the user to log in.

    1. public function deleteAllMessages()
    2. {
    3.     // delete messages only if user has super user access, otherwise show an error message
    4.     Piwik::checkUserSuperUserAccess();
    5.  
    6.     $this-&gt;getModel()-&gt;deleteAllMessages();
    7. }

    Télécharger

    Use methods that return a boolean for instance when registering menu items or widgets.

    1. public function configureAdminMenu(MenuAdmin $menu)
    2. {
    3.     if (Piwik::hasUserSuperUserAccess()) {
    4.         $menu-&gt;addPlatformItem('Plugins', $this-&gt;urlForDefaultAction());
    5.     }
    6. }

    Télécharger

    It is important to be aware that just because the menu item won’t be displayed in the UI a user can still open the registered URL manually. Therefore you have to check for permissions in the actual controller action as well.

    View permission

    A user having a view permission should be only able to view reports but not make any changes apart from his personal settings. The methods that end with UserHasSomeViewAccess make sure a user has at least view permission for one website whereas the methods *UserHasViewAccess($idSites = array(1,2,3)) check whether a user has view access for all of the given websites.

    1. Piwik::checkUserHasSomeViewAccess();
    2.  
    3. Piwik::checkUserHasViewAccess($idSites = array(1,2,3));

    Télécharger

    As a plugin developer you would usually use the latter example to verify the permissions for specific websites. Use the first example in case you develop something like an “All Websites Dashboard” where you only want to make sure the user has a view permission for at least one website.

    Admin permission

    A user having an admin permission cannot only view reports but also change website related settings. The methods to check for this role are similar to the ones before, just swap the term View with Admin.

    1. Piwik::checkUserHasSomeAdminAccess();
    2.  
    3. Piwik::checkUserHasAdminAccess($idSites = array(1,2,3));

    Télécharger

    Super user permission

    A user having the super user permission is allowed to access all of the data stored in Piwik and change any settings. To check if a user has this role use one of the methods that end with UserSuperUserAccess.

    Piwik::checkUserHasSuperUserAccess();

    As a plugin developer you would check for this permission for instance in places where your plugin shows an activity log over all users or where it offers the possibility to change any system wide settings.

    Getting information about the currently logged in user

    Sometimes you might want to know which user is currently logged in. This can be useful if you want to persist user related information in the database or if you want to send an email to the currently logged in user. You can easily get this information by calling the following methods :

    1. $login = Piwik::getCurrentUserLogin()
    2. $email = Piwik::getCurrentUserEmail()

    Télécharger

    Advanced features

    Of course there is more that you can do. For instance you can verify whether a user is an anonymous user or whether a user has a specific role. You can also perform any operation in the context of a super user even if the current user does not have this role. Would you like to know more about those features ? Check out the Piwik class reference, the Security guide and the Manage Users user guide.

    If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.