Giter Club home page Giter Club logo

Comments (9)

Mis012 avatar Mis012 commented on June 2, 2024

hmm, it seems I'm able to change the rendered "bgcolor"...
so it does something

from freshplayerplugin.

Mis012 avatar Mis012 commented on June 2, 2024

probably an issue with ignoring unrequested stream

from freshplayerplugin.

Mis012 avatar Mis012 commented on June 2, 2024

Ok, got it to work to a point where the last needed hack is this:

diff --git a/src/ppb_url_loader.c b/src/ppb_url_loader.c
index 9690d83..8f930f9 100644
--- a/src/ppb_url_loader.c
+++ b/src/ppb_url_loader.c
@@ -241,10 +241,12 @@ open_temporary_file(void)
 {
     char *tmpfname;
     // TODO: make temp path configurable
-    tmpfname = g_strdup_printf("/tmp/FreshStreamXXXXXX");
-    int fd = mkstemp(tmpfname);
-    unlink(tmpfname);
-    g_free(tmpfname);
+//    tmpfname = g_strdup_printf("/tmp/FreshStreamXXXXXX");
+//    int fd = mkstemp(tmpfname);
+
+       int fd = open("/path/to/actual/file.swf", O_RDONLY);
+//    unlink(tmpfname);
+//    g_free(tmpfname);
     return fd;
 }

but as I understand it, freshplayer should try to capture the first unrequested stream and use that in order to behave just like NPAPI flash?

from freshplayerplugin.

i-rinat avatar i-rinat commented on June 2, 2024

freshplayer should try to capture the first unrequested stream and use that in order to behave just like NPAPI flash?

Yes, as far as I remember. When NPAPI Flash instance is created, browser itself initiates a flash movie download. So the first stream plugin gets is the .swf file. With PPAPI, browser does nothing, and the plugin is requesting a download.

See #153 and abe3d52.

from freshplayerplugin.

Mis012 avatar Mis012 commented on June 2, 2024

ok, I have figured out the issue

there is a race condition, if the NPAPI "browser" doesn't stream the file fast enough (ideally in one call to Write), it seems either freshplayer or flash will give up

from freshplayerplugin.

Mis012 avatar Mis012 commented on June 2, 2024

if I stream the file in one go like this:

	FILE *pp;
	char buffer[1977354];
	pp = fopen(filename,"rb");
	int len;
	while((len=fread(buffer, 1, sizeof(buffer), pp)) != 0) {
		pluginFuncs.writeready(instance, stream);
		pluginFuncs.write(instance, stream, 0, len, buffer);
	}
	fclose(pp);

where 1977354 is the file size, everything works with zero modifications to freshplayer

from freshplayerplugin.

i-rinat avatar i-rinat commented on June 2, 2024

Speaking of file sizes. simple-linux-flash-embed seems to hardcode file size here: https://github.com/idaunis/simple-linux-flash-embed/blob/b7d6ea436470a87659a5b1e59b54480c0664c303/player.c#L364. Did you try to change 99782 to -1 there? It may be important to have either correct data size there or -1. Otherwise Flash may decide to stop getting SWF content when it gets 99782 bytes.

from freshplayerplugin.

Mis012 avatar Mis012 commented on June 2, 2024

no difference unfortunately :(

from freshplayerplugin.

i-rinat avatar i-rinat commented on June 2, 2024

Try this patch:

diff --git a/player.c b/player.c
old mode 100755
new mode 100644
index 4925ec0..8690aa4
--- a/player.c
+++ b/player.c
@@ -226,7 +226,7 @@ switch (variable) {
 		*((int*)ret_value)= NPNVGtk2;
 		break;
 	case NPNVnetscapeWindow:
-		*((int*)ret_value)= PR_TRUE;
+		*((int*)ret_value)= None;
 		break;
 	default:
 		*((int*)ret_value)=PR_FALSE;
@@ -360,9 +360,9 @@ static NPWindow * npwindow_construct (GtkWidget *widget) {
 static NPStream * npstream_construct() {
     NPStream *stream = (NPStream *) malloc(sizeof(NPStream));
     
-    stream->url=strdup(URL);
+    stream->url=strdup("http://127.0.0.1/movie.swf");
     stream->ndata = 0;
-    stream->end = 99782;
+    stream->end = 0;
     stream->lastmodified= 1201822722;
     stream->notifyData = 0x00000000;
     stream->headers = NULL;
@@ -908,9 +908,11 @@ int main(int argc, char **argv)
 	char buffer[8192];
 	pp = fopen(argv[1],"rb");
 	int len;
+	int offset = 0;
 	while((len=fread(buffer, 1, sizeof(buffer), pp)) != 0) {
 		pluginFuncs.writeready(instance, stream);
-		pluginFuncs.write(instance, stream, 0, len, buffer);
+		pluginFuncs.write(instance, stream, offset, len, buffer);
+		offset += len;
 	}
 	fclose(pp);
 

The only essential part are: url being URL, and correct values of offset. Looks like NPAPI Flash ignored offsets, but I for some reason decided that if there is a parameter, I must honor it. I don't know for sure why URL matters, but it's something inside PPAPI Flash itself. If ->url is not an URL, it just doesn't try to load a movie.

stream->end doesn't seem to change anything, but freshplayerplugin converts 0 to -1, which is what in PPAPI "language" means that size is not known in advance.

NPNVnetscapeWindow is not really required too, but plugin expects there a browser window handle, not a boolean. Setting it to None prevents BadWindow errors (code 3).

from freshplayerplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.