Best way to include assets files is by creating an AAR file that is referenced from your library and it includes an assets folder with the files. AAR file = zip file.
i've used the steps shown in the link referenced by lucams above. works fine. it pre-dates the .aar approach (i don't think .aar existed at that point).
Best way to include assets files is by creating an AAR file that is referenced from your library and it includes an assets folder with the files. AAR file = zip file.
you need a function/method in your library that accepts parameter from the app, and you just call it from the app, passing that parameter. how do you set the player in motion anyway? did you write a wrapper? or are you using some .jar you found? if you wrote a wrapper, you add the method. if it's an external .jar, it needs to have such a public method in place already, and you tap into it with a javaobject.runmethod() call
' (you'd need java, of course;). this is pseudo b4a)
if string starts with "http" or "https" or "rtmp" or "whatever..." then
play url
else
play local file
end if
or are you saying, you don't know how to play a local file even if you had its name and location? b4a has had several media players that stream and play locally. not sure what your library does
' (you'd need java, of course;). this is pseudo b4a)
if string starts with "http" or "https" or "rtmp" or "whatever..." then
play url
else
play local file
end if
or are you saying, you don't know how to play a local file even if you had its name and location? b4a has had several media players that stream and play locally. not sure what your library does
thanks for reply.
this library can play and record video send into it, just need the URL or the file path. now don't know how to get file path... in window it is always like "file://111/111.mp4" ,in Android it is different i think.
android works something like this: file:///android_asset/whatever.mp4 sometimes, with 2 //'s seems to work. but there is a problem with dir.asset: the files are stored compressed. when you load a file from dir.assets in b4a, b4a unzips it automatically. i don't think passing its name is going to unzip it, and i don't think your player will know what to do if it gets a compressed file. you might have to add an unzip function to your library.
or you could copy the file to dir.internal first and pass it from there (it's unzipped before the copy). in that case the local link needs to be different.
i don't believe file:///android_dirinternal works. so what you will probably have to do is assign file.dirinternal to a string to get the real path. then you can do:
dim realpath as string = file.dirinternal
and pass the real path: file:///real_path/whatever.mp4. if you log file.dirinternal, you can see the actual path. (and don't be surprised if someone comments that you're not supposed to refer to file.dirinternal by what it actually resolves to. i would guess we use file.dirinternal because it could point to somewhere different whenever google feels like pointing it somewhere different. i would think assigning it to a string in this case would be safe. but if there is an approved way and somebody tells you, take note and go with it.)