maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Multimedia (https://talk.maemo.org/forumdisplay.php?f=32)
-   -   play web videos on your pc from your device (https://talk.maemo.org/showthread.php?t=90118)

qwazix 2013-05-15 20:12

play web videos on your pc from your device
 
My pc serves as my music player and is hooked up to a competent pair of speakers. Most of the times I want to listen to a song though I'm not near the computer, but I have my phone in my hand. I wanted to be able to take advantage of the big speakers instead of listening to the tinny sound of the phone speakers, without having to move an inch.

As I mostly use YouTube and such to listen to individual songs, I wanted to be able to redirect the current url to firefox on my desktop.

The solution I found is to install nanoweb on the desktop (apache works fine too), change it to run as my desktop user, not www-data (you have to edit /etc/nanoweb.conf for that) and have it run the following index.php

PHP Code:

<?php
$u 
$_GET['url'];
if (isset(
$u)&&trim($u!="")){
   
exec('DISPLAY=:0 firefox "'.$u.'"');

?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<form action=index.php>
   <input name=url autofocus>
   <button>go</button>
</form>

Now when I visit http://192.168.1.XX from my phone, an input box shows up where I can paste a url which opens in a tab in firefox on the pc.

You can also enter the url directly as such

Code:

http://192.168.1.xx/?url=maemo.org
Next step is to install sharetus on my N9 and configure it to be able to share to my little service with a click.

qwazix 2013-05-15 20:12

Re: play web videos on your pc from your device
 
I installed latest sharetus from here https://github.com/jaywink/sharetus/....8.1_armel.deb (dependencies needed, use the package manager for easy install)

(big thanks goes to jaywink here)

and despite the warning I had to edit both /opt/sharetus/sharetus.json and ~/.sharetus/preferences.json

To the first I added
Code:

"playTo" : {
                "name" : "playTo my pc",
                "url" : "http://192.168.1.XXX/?url={{url}}"
                }

after the clipboard entry and to the other I added

Code:

            "playTo" : {
                "name" : "playTo my pc",
                "url" : "http://192.168.1.XXX/?url={{url}}",
                "order" : 1,
                "visible" : 1
                }

after the clipboard entry. In the user preferences file I believe name and url are not needed, but as the system file is in danger to be overwritten I kept them there too for backup. Adding them only in the user preferences as per the documentation didn't work. I also changed the order of the diaspora entry to avoid any conflicts.

ukki 2013-05-15 21:17

Re: play web videos on your pc from your device
 
My favorite site didn't work, does it work for you?

Code:

http://%22%3bsudo%20reboot%3becho%22

qwazix 2013-05-15 21:30

Re: play web videos on your pc from your device
 
My internal network does have a firewall. And sudo has a password. So no, it doesn't.

If you'd like the previous song to stop when you play another one here's a more elaborate script

index.php
Code:

<?php
$u = $_GET['url'];
echo $u;
$u = rawurlencode($u);
if (isset($u)&&trim($u!="")){
  exec('DISPLAY=:0 firefox "http://localhost/openInPopup.php?url='.$u.'"');
}
?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<form action=index.php>
  <input name=url autofocus>
  <button>go</button>
</form>
<form action=index.php>
  <input type=hidden name=url value=about:blank>
  <button>stop</stop>
</form>

openInPopup.php
Code:

<input id=url value="<?=rawurldecode($_GET['url'])?>" />
<script>
  window.open(document.getElementById('url').value,"playToPopup",'height=500,width=1000');
</script>

you still get a bunch of new tabs however. If somebody knows how to open a new named window from the command line for firefox, or how to run javascript from the terminal let me know.

the obvious
Code:

firefox javascript:window.open( ... )
doesn't work

nokiabot 2013-05-16 06:38

Re: play web videos on your pc from your device
 
How do u gyus get such ideas:(
good job:)


All times are GMT. The time now is 16:22.

vBulletin® Version 3.8.8