You are right, the example does not work with HTTP urls. I didn't look
closely enough the first time.
I've fixed the example at
http://swfdec.freedesktop.org/wiki/SwfdecExamples now and attached the
fixed file here.

Benjamin


On Wed, Sep 23, 2009 at 10:16 AM, Ivaylo Strandjev <istrand...@gmail.com> wrote:
> Hello,
> I just copy pasted the example source code and it does not open any
> online urls. I have tried the following:
> http://www.shockwave.com/content/blocky/sis/blocky.swf (that is found
> in the screenshots section and so I guessed is for sure able to open
> with swfdec),
> http://i.dir.bg/r2009/dsk/mobiDSK_DirBG_300_250_02.swf which is opened
> without any problem if I download the file to the computer and then
> pass it with file:// + location
> I just edited the source code of the example so that it prints "This
> is not a flash file!" if the if -clause on line 69 is true and it is
> printed after execution so I guess something is wrong. I am attaching
> the source code I use(although it is pretty much the one given here
> http://swfdec.freedesktop.org/wiki/SwfdecExamples).
> I would like to remind you that I am using Kubuntu 9.0.2. The compile
> command I use is
> g++ example.cpp
> /home/astea/workspace/swfdec-0.9.2/swfdec/.libs/libswfdec-0.9.a
> /home/astea/workspace/swfdec-0.9.2/swfdec-gtk/.libs/libswfdec-gtk-0.9.a
> -o run -I/home/astea/workspace/swfdec-0.9.2/ `pkg-config --cflags
> --libs --static cairo gdk-2.0 pango atk liboil-0.3 gdk-x11-2.0
> pangoft2` -lsoup-2.4 -lasound -lgtk-x11-2.0 -lgstbase-0.10
> -lgstpbutils-0.10
> Currently this uses swfdec-0.9.2 but I have tried the same example
> with the swfdec-devel package and there was no change again the
> program entered the same if clause.
> After I compile the command I type in for instance:
> ./run http://www.shockwave.com/content/blocky/sis/blocky.swf
> and get
> This is not a flash file!
> I tried the same if I save the .swf file on my computer and type:
> ./run file:///home/astea/download/blocky.swf
> and everything is fine the flash is opened.
> Am I doing something wrong? Or there is some other problem?
>
> 2009/9/21 Benjamin Otte <o...@gnome.org>:
>> Hi,
>>
>> the example definitely works with online URLs. Note that it uses
>> SwfdecGtkPlayer to do this, and not the default SwfdecPlayer.
>> The code that implements a custom loader using libsoup is in
>> swfdec-gtk/swfdec_gtk_loader.c. There are other examples on how to
>> write a custom loader (i.e. in the Mozilla plugin).
>>
>> Hope that helps,
>> Benjamin
>>
>>
>> On Tue, Sep 15, 2009 at 3:35 PM, Ivaylo Strandjev <istrand...@gmail.com> 
>> wrote:
>>> Hello,
>>> I have been struggling to get swfdec player work for some weeks but I
>>> couldn't find any examples online to help me. I already wrote I flash
>>> player that plays swf file from the local file system but I still can
>>> not open flash movies online. I read through the posts in this mailing
>>> list for some years ago and found a post where it is said that I need
>>> to create my own loader that swfdec_stream_push -es its data but I
>>> find the documentation on those classes rather vague and there are no
>>> examples available.
>>> Also i tried the example that is on swfdec wiki but it still does not
>>> open online url-s. After some debugging I found out that it enters the
>>> if (next < 0)
>>>  {
>>>    /* not a flash file */
>>>    fprintf(stderr,"this is not a flash file!\n");
>>>    return 0;
>>>  }
>>> part. So even this example can not open online .swf files even though
>>> it says to be capable of. I am trying to build my application on linux
>>> 32/64 mac 32/64 and win 32/64 but the main platform i try it on is
>>> kubuntu 9.0.4 @ 64bit
>>> I would appreciate any help and some examples. Thank you for your time.
>>> Best regards,
>>> Ivaylo
>>> _______________________________________________
>>> Swfdec mailing list
>>> Swfdec@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/swfdec
>>>
>>
>
//Created by : pepsidrin...@hotmail.com
// Date : Sept. 15 2008

#include <swfdec-gtk/swfdec-gtk.h>


/*
Simple SWFDEC ---> version 0.8.0 <---- playback tutorial :
This tutorial may contain error(s) and/or ugly code.
It is not optimized at all.
Feel free to change it as you wish
*/

static void
playback_aborted (SwfdecPlayer *player)
{
  if (swfdec_player_is_initialized (player))
    g_print ("Given file is not a Flash file.");
  else
    g_print ("Broken Flash file.");

  gtk_main_quit();
}

static void
print_infos (SwfdecPlayer *player)
{
  guint h,w;

  //SWFDEC_PLAYER type infos
  g_print("Max runtime : %lu\n",swfdec_player_get_maximum_runtime (player));
  swfdec_player_get_default_size(player,&h,&w);
  g_print("Size: %d, %d\n",h,w);
  g_print("BG Color : %d\n",swfdec_player_get_background_color(player));
  g_print("Rate: %f\n",swfdec_player_get_rate(player));
 
  //SWFDEC_GTK_PLAYER type infos
  g_print("Speed :%f\n",swfdec_gtk_player_get_speed (SWFDEC_GTK_PLAYER(player)));
  g_print("Audio enabled : %d\n",swfdec_gtk_player_get_audio_enabled (SWFDEC_GTK_PLAYER(player)));
  g_print("Is playing :%d\n",swfdec_gtk_player_get_playing(SWFDEC_GTK_PLAYER(player)));
}


int 
main (int argc, char **argv)
{
  SwfdecPlayer *player;
  // GTK init stuff
  GtkWidget *window, *widget;
  gtk_init (&argc, &argv);
  
  if (argc < 2) 
  {
    g_print ("usage: %s file://PATH or URL", argv[0]);
    // Ex: file://foobar.swf OR http://www.foo.bar/foobar.swf
    return 1;
  }
  
  //Create a new player
  player = swfdec_gtk_player_new (NULL);

  //Pass out the URL or File Path
  SwfdecURL* url = swfdec_url_new(argv[1]);
  swfdec_player_set_url(player,url);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  widget = swfdec_gtk_widget_new (player);
  gtk_container_add (GTK_CONTAINER (window), widget);
  gtk_widget_show_all (window);

  //Get notifications
  g_signal_connect (player, "notify::initialized", G_CALLBACK (print_infos), NULL);
  g_signal_connect (player, "notify::aborted", G_CALLBACK (playback_aborted), NULL);

  //Play !
  swfdec_gtk_player_set_playing (SWFDEC_GTK_PLAYER (player), TRUE);
  
  //GTK main loop
  gtk_main ();

  return 0;
}
_______________________________________________
Swfdec mailing list
Swfdec@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/swfdec

Reply via email to