Android - Access remote URL from SWF (JW Player) embedded in assets folder - android

I am loading an HTML file from my assets folder into a WebView using loadUrl(). The HTML file references a JW Player swf embedded alongside it in the assets folder.
I want JW Player to play a remote URL. Sadly, it will not.
If I load the SWF remotely from another server (instead of using the SWF in my assets folder) I can access external URL's. In this case, the external URL is an RTMP stream. For example:
<!DOCTYPE html>
<html lang='en'>
<head><meta charset='utf-8'>
</head>
<body style='margin:0; pading:0;background-color: #000000;'>
<script type='text/javascript' src='http://developer.longtailvideo.com/svn/trunk/fl5/jwplayer.min.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'http://developer.longtailvideo.com/svn/trunk/fl5/player.swf',
'file': 'testvid.mp4',
'streamer': 'rtmp://b27i9s9t3.rtmphost.com/AndroidMedia',
'controlbar': 'bottom',
'width': '800',
'height': '450'
});
</script>
</body>
...works
<!DOCTYPE html>
<html lang='en'>
<head><meta charset='utf-8'>
</head>
<body style='margin:0; pading:0;background-color: #000000;'>
<script type='text/javascript' src='file:///android_asset/jwplayer.min.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'file:///android_asset/player.swf',
'file': 'testvid.mp4',
'streamer': 'rtmp://b27i9s9t3.rtmphost.com/AndroidMedia',
'controlbar': 'bottom',
'width': '800',
'height': '450'
});
</script>
</body>
...does not work. JW Player loads - but once the play button is hit it flashes a quick "connection unavailable: error #2028" and then spins the ajax spinner forever.
I'm assuming this is a general issue with all SWF's loaded from the assets folder into a web view and is not specific to JW Player.
Any ideas?

Related

react-native webview localfile

Problem:
I should display offline a Html page stored in my react-native app, and for to do it I used WebView:
<WebView
originWhitelist={['*']}
source = {{uri:'file:///android_asset/index.html'}}
/>
but it load just html file without css and/or js, this is an example of my html page:
my file html is stored in: react-native-project->android->app->src->main->assets->web
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/styles.css"/>
</head>
<body >
<h1>Hello World</h1>
</body>
</html>
this is an example of my css page:
my file css is stored in: react-native-project->android->app->src->main->assets->web->css
h1 {
color:red;
}
I have found this post on medium but not work for my and BaseUrl not work.
Question:
How I can display a Html page with relative file css and js connected to it offline on react-native?
can I use the cache how do react-native-offline-cache-webview ?
Thanks for your attention and sorry if my English is wrong but I'm not a native speaker bye

How to play mp3 file using Jquery in android PhoneGap

i want to play mp3 file in background using jQuery in android phoneGap, i have included cordova-2.2.0.js with jquery-1.9.0.js file .. here is my html code. what i am doing wrong while i have given all permissions in Manifest File
here is my html page
<!DOCTYPE HTML>
<html>
<head>
<title>First App</title>
</head>
<body>
<h1>Welcome to PhoneGap</h1>
<h2>Edit assets/www/index.html</h2>
<script src="cordova-2.2.0.js"></script>
<script src="jquery-1.9.0.js"></script>
<script>
$(document).ready(function(){
alert("hey");
var audio = new Audio();
audio.src = "audio.mp3";
audio.play();
});
</script>
</body>
</html>
try this link, use media instead of audio
var myaudio = new Media('/android_asset/www/audio/file.mp3');
for Your Error Attempt to call getDuration without valid media player
try this links
https://groups.google.com/forum/#!topic/phonegap/aa_2dHjy9C0
http://www.anddev.org/multimedia-problems-f28/mediaplayer-attempt-to-call-getduration-without-t51386.html
Android: attempt to call getduration without a valid mediaplayer
http://maffelu.net/phonegap-attempt-call-getduration-without-valid-mediaplayer/
i am saying to check this link bacause you have not posted the android code so try it.
Hope this will help.

Android JW Player issue

I had implement JW Player in android, but getting black screen when video load from live URL.
My HTML file
<!DOCTYPE html>
<html>
<head>
<script src="http://jwpsrv.com/library/WcmD+p3DEeKQvCIACpYGxA.js"></script>
</head>
<body>
<div id='my-video'></div>
<script type='text/javascript'>
jwplayer('my-video').setup({
file: 'http://content.bitsontherun.com/videos/lWMJeVvV-364767.mp4',
image: 'http://www.longtailvideo.com/content/images/jw-player/lWMJeVvV-876.jpg',
width: '320',
height: '180'
});
</script>
</body>
</html>
and my Java Code is
myBrowser.getSettings().setJavaScriptEnabled(true);
myBrowser.loadUrl("http://. . . /hardik/jwplayerhtml.html");
what is wrong with me? Please help me.

Can't play this video error in MacDonst videoplayer

I’m trying to play a simple .MP4 via the MACDONST plugin, but get an error reading “Can’t play this video” as soon as the video player is displayed. I can play the video file in the Android standalone video player, and I can call a Youtube video via the plugin. Many thanks for your help! Here's my page code:
<!DOCTYPE html>
<html>
<head>
<title>InAppBrowser.addEventListener Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
<script type="text/javascript" charset="utf-8" src="video.js"></script>
<script type="text/javascript">
//app.initialize();
function init()
{
document.addEventListener("deviceready", console.log('ready'), true);
}
function playVideo(vidUrl) {
//alert("Starting Vid Script");
window.plugins.videoPlayer.play(vidUrl);
}
</script>
</head>
<body onload="javascript:init()">
Play Stream<br>
Play File<br>
Play File from SD<br>
</div>
</body>
</html>
First you create directory in your www location directory I named videos.
then put your stigma.mp4 file into the videos directry then call your path like bellow mentioned
Play File
Note: your video file dose not contain any special character like (, & - & _ etc..) only file file extention .mp4

phonegap: loading remote html

I'm searching for a way to load remote html's in phonegap android app.
I'm using super.loadUrl("file:///android_asset/www/hello.html"); but how to load remote html page?
it's very simple Venkat,
just load required html page with the http request,
super.loadUrl("http://www.test.com/test1.html");
or you can load local html file like you did
super.loadUrl("file:///android_asset/www/hello.html");
and in hello.html used window.location in onLoad() javascript function to load external html page.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!-- Change this if you want to allow scaling -->
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>LoadUrl
<script type="text/javascript" charset="utf-8">
function onBodyLoad()
{
document.addEventListener("deviceready",onDeviceReady,false);
}
/* When this function is called, PhoneGap has been initialized and is ready to roll */
function onDeviceReady()
{
// do your thing!
window.location="http://170.60.26.20:8099/Sencha/Html/index.html";
}
</script>
</head>
<body onload="onBodyLoad()">
</body>
</html>
Please make sure you set the internet permission in android manifest file.

Categories

Resources