Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (93)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • 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 (...)

Sur d’autres sites (7376)

  • Uploading videos on rails website

    16 mai 2017, par Dinukaperera

    I am trying to let my users upload videos on my website(not deployed yet, testing locally). I have it set up in a manner where if the "user information" gets saved, it will take them to the "root_path", which is the homepage. If the user information is not saved, it will render the form again. Before I added the video upload feature, all the information got saved and everything worked well, but after adding the feature, it keeps rendering the same form over and over again since the information is not getting saved. How do I check what’s wrong ? The command line gives me this error : Error screenshot

    The user information form partial :
    `

    <%= simple_form_for @userinfo do |f| %>
     <%= f.input :name, label: 'Full name', error: 'Full name is mandatory' %>
     <%= f.input :username, label: 'Username', error: 'Username is mandatory, please specify one' %>
     <%= f.input :school, label: 'Name of college' %>
     <%= f.input :gpa, label: 'Enter GPA' %>
     <%= f.input :email, label: 'Enter email address' %>
     <%= f.input :number, label: 'Phone number' %>
     <%= f.file_field :video %>
     <%= f.button :submit %>
    <% end %>

    `

    My user controller (This is the user information controller, does not control user email and password. I’m using the devise gem for user sign in, sign out, and sign up) :`

    class UsersController < ApplicationController
       def index
       end

       def show
       end

       def new
           @userinfo = User.new
       end

       def create
           @userinfo = User.new(user_params)
           if @userinfo.save
             redirect_to root_path
           else
             render 'new'
           end
       end

       def edit
       end

       def update
       end

       def destroy
       end

       private
           def user_params
               params.require(:user).permit(:name, :username, :email, :number, :school, :gpa, :major, :video)
           end
    end

    `

    This is the user model (usermain is the model related to user password and email. The user information in the user model belongs to the usermain) : `

    class User < ActiveRecord::Base
       belongs_to :usermain

       has_attached_file :video, styles: {:video_show => {:geometry => "640x480",:format => 'mp4'},:video_index => { :geometry => "160x120", :format => 'jpeg', :time => 10}}, :processors => [:transcoder]
       validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
    end

    `

    This is the migration file that creates the user information table :`

    class CreateUsers < ActiveRecord::Migration
     def change
       create_table :users do |t|
         t.string :name
         t.string :username
         t.string :email
         t.string :number
         t.string :school
         t.string :gpa
         t.string :major

         t.timestamps null: false
       end
     end
    end
    This is adding the "video" field to the above created user information table:
    class AddAttachmentVideoToUsers < ActiveRecord::Migration
     def self.up
       change_table :users do |t|
         t.attachment :video
       end
     end

     def self.down
       remove_attachment :users, :video
     end
    end

    `

    I also have paperclip and ffmpeg installed. When I say installed, it’s literally just that. I’m not sure if I have to manipulate paperclip or ffmpeg in any way to make it work with the videos, I have just installed and did nothing else with them. I have been pulling my hair out for the past two days. Any help is appreciated.

  • Converting a video to a GIF

    21 novembre 2019, par Wolfiebae

    I am trying to make my app to accept videos from the phone’s library to be uploaded and converted into GIF format. My code is giving out this build error though :-

    error: <anonymous> is not abstract and does not override abstract method onReschedule(String,ErrorInfo) in UploadCallback
    </anonymous>

    and also this warning on my onActivityResult method :-

    Overriding method should call super.onActivityResult

    The code is as below : -

    public class Video2gif extends AppCompatActivity {

       private Button uploadBtn;
       private ProgressBar progressBar;
       private int SELECT_VIDEO = 2;
       private ImageView img1;
       private DownloadManager downloadManager;
       private Button download_btn;
       private String gifUrl;

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_video2gif);
           MediaManager.init(this);

           progressBar = findViewById(R.id.progress_bar);
           MediaManager.init(this);
           img1 = findViewById(R.id.img1);
           uploadBtn = findViewById(R.id.uploadBtn);

           uploadBtn.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View view) {
                   pickVideoFromGallery();

               }
               private void pickVideoFromGallery() {
                   Intent GalleryIntent = new Intent();
                   GalleryIntent.setType("video/*");
                   GalleryIntent.setAction(Intent.ACTION_GET_CONTENT);
                   startActivityForResult(Intent.createChooser(GalleryIntent,
                           "select video"), SELECT_VIDEO);
               }
           });
       }
       @Override
       protected void onActivityResult(int requestCode, int resultCode, final Intent data) {

           if (requestCode == SELECT_VIDEO &amp;&amp; resultCode == RESULT_OK) {
               Uri selectedVideo = data.getData();
               MediaManager.get()
                       .upload(selectedVideo)
                       .unsigned("myid")
                       .option("resource_type", "video")
                       .callback(new UploadCallback(){
                           @Override
                           public void onStart(String requestId) {
                               progressBar.setVisibility(View.VISIBLE);
                               Toast.makeText(Video2gif.this,
                                       "Upload Started...", Toast.LENGTH_SHORT).show();
                           }

                           public void onProgress() {
                           }

                           public void onSuccess(String requestId, Map resultData) {

                               Toast.makeText(Video2gif.this, "Uploaded Succesfully",
                                       Toast.LENGTH_SHORT).show();
                               progressBar.setVisibility(View.GONE);
                               uploadBtn.setVisibility(View.INVISIBLE);

                               String publicId = resultData.get("public_id").toString();

                               gifUrl = MediaManager.get().url().resourceType("video")
                                       .transformation(new Transformation().videoSampling("25")
                                               .delay("200").height(200).effect("loop:10").crop("scale"))
                                       .resourceType("video").generate(publicId+".gif");

                               Glide.with(getApplicationContext()).asGif().load(gifUrl).into(img1);
                               download_btn.setVisibility(View.VISIBLE);

                           }
                           public void onError(String requestId, ErrorInfo error) {
                               Toast.makeText(Video2gif.this,
                                       "Upload Error", Toast.LENGTH_SHORT).show();
                               Log.v("ERROR!!", error.getDescription());
                           }


           });
       }
    }

    }

    I am also using Cloudinary to help process the video to GIF. Any help would be appreciated, many thanks !

  • Converting video to GIF in Android Studio

    21 novembre 2019, par Wolfiebae

    I am trying to make my app to accept videos from the phone’s library to be uploaded and converted into GIF format. My code is giving out this build error though :-

    error: <anonymous> is not abstract and does not override abstract method onReschedule(String,ErrorInfo) in UploadCallback
    </anonymous>

    and also this warning on my onActivityResult method :-

    Overriding method should call super.onActivityResult

    The code is as below : -

    public class Video2gif extends AppCompatActivity {

       private Button uploadBtn;
       private ProgressBar progressBar;
       private int SELECT_VIDEO = 2;
       private ImageView img1;
       private DownloadManager downloadManager;
       private Button download_btn;
       private String gifUrl;

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_video2gif);
           MediaManager.init(this);

           progressBar = findViewById(R.id.progress_bar);
           MediaManager.init(this);
           img1 = findViewById(R.id.img1);
           uploadBtn = findViewById(R.id.uploadBtn);

           uploadBtn.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View view) {
                   pickVideoFromGallery();

               }
               private void pickVideoFromGallery() {
                   Intent GalleryIntent = new Intent();
                   GalleryIntent.setType("video/*");
                   GalleryIntent.setAction(Intent.ACTION_GET_CONTENT);
                   startActivityForResult(Intent.createChooser(GalleryIntent,
                           "select video"), SELECT_VIDEO);
               }
           });
       }
       @Override
       protected void onActivityResult(int requestCode, int resultCode, final Intent data) {

           if (requestCode == SELECT_VIDEO &amp;&amp; resultCode == RESULT_OK) {
               Uri selectedVideo = data.getData();
               MediaManager.get()
                       .upload(selectedVideo)
                       .unsigned("myid")
                       .option("resource_type", "video")
                       .callback(new UploadCallback(){
                           @Override
                           public void onStart(String requestId) {
                               progressBar.setVisibility(View.VISIBLE);
                               Toast.makeText(Video2gif.this,
                                       "Upload Started...", Toast.LENGTH_SHORT).show();
                           }

                           public void onProgress() {
                           }

                           public void onSuccess(String requestId, Map resultData) {

                               Toast.makeText(Video2gif.this, "Uploaded Succesfully",
                                       Toast.LENGTH_SHORT).show();
                               progressBar.setVisibility(View.GONE);
                               uploadBtn.setVisibility(View.INVISIBLE);

                               String publicId = resultData.get("public_id").toString();

                               gifUrl = MediaManager.get().url().resourceType("video")
                                       .transformation(new Transformation().videoSampling("25")
                                               .delay("200").height(200).effect("loop:10").crop("scale"))
                                       .resourceType("video").generate(publicId+".gif");

                               Glide.with(getApplicationContext()).asGif().load(gifUrl).into(img1);
                               download_btn.setVisibility(View.VISIBLE);

                           }
                           public void onError(String requestId, ErrorInfo error) {
                               Toast.makeText(Video2gif.this,
                                       "Upload Error", Toast.LENGTH_SHORT).show();
                               Log.v("ERROR!!", error.getDescription());
                           }


           });
       }
    }

    }

    I am also using Cloudinary to help process the video to GIF. Any help would be appreciated, many thanks !