Plex / Python / Chromecast - Google Chromecast

So, I'm trying to cast plex content to my chromecast using a python script on the server. Using PlexAPI I can connect to the server and navigate my content just fine. Using pychromecast, I can connect python to my chromecast. Using the Plex Media Controller, I can even use .play() to bring the basic plex background up on the chromecast. What I -can't- seem to do is tell the plex on the chromecast WHAT to play from python... or to even actually start playing any media that isn't already playing there; it just sits there. Anyone have any insights?

Alright, well here's where I am: As near as I can tell, there's no way to tell the Plex Chromecast Receiver to play a title/file/anything, even once it's up. I can, of course, use PlexAPI to do things like poll for the oldest unwatched episode of something. Therefore, I'm currently tinkering with getting the episode file with PlexAPI and then sending to the chromecast with stream2chromecast. This lets me transcode, at least, to make the right video play (with audio even). Unfortunately, when transcoding, the "pause"/"continue" functions of stream2chromecast don't work. Not sure what's up with that, but it's on their end.
EvenGhost was being a pita and kept crashing on me for some reason, so I gave up on it and wrote a Tornado server into the python script. Not ideal, nor do I really want a webserver up and running at home, but it is what it is for the moment.
So the current flow goes "Google Home -> IFTTT -> Maker -> Tornado Server (python code inside) -> Chromecast.
Using this, I can now say "Okay Google, Chromecast the latest episode of MayGyver"... and in a few seconds the oldest unwatched episode from my Plex server will start to play on my TV. (I can also say, "Okay Google, chromecast stop" and it will stop.)
Sadly, because I'm sidestepping Plex for the actual playing, it doesn't show up under "now playing". Nor does it mark the episode as watched if you finish it.

Alright, well. Today's progress update. Rather than continue the external tracking path, I've dropped back to attempting to make it play to the Plex app on the Chromecast. I originally thought this impossible, but I did manage to make some progress.
I still cannot make a video play via this method, but I -am- able to bring up the "Details" page of any given movie or episode or whatever onto the Chromecast. I accomplished this by digging into the pychromecast Controllers and its notes about custom namespaces. I did the whole "net-internals/#capture" thing the github mentions to explore the namespace. Digging through, that gave me what commands are being sent to the Chromecast when I cast from my browser. I translated the two commands there (SHOWDETAILS and LOAD) into the Plex Controller. I was somewhat surprised when ShowDetails actually worked.... but then shatteringly disappointed when LOAD did not.
I feel like I'm so close on this now, but still missing a piece of the puzzle.

Nice work. You've converted me - I was just using the standard media controller to access the respective Plex url. The tips above helped guide me in the right direction. So thanks - and keep posting your progress. I'll see what I can figure out as well. I assume you already sorted out the transient access tokens that look to be required?

Ok I got the play working via Python.
I use this API - github.com/mjs7231/python-plexapi
The key things I had to do:
1. Grab a transient token for the request
Code:
server.query('/security/token?type=delegation&scope=all').attrib('token')
2. And I created a playQueue id for the request
Code:
server.createPlayQueue(video).playQueueID
3. The LOAD command must be run in the namespace:
Code:
urn:x-cast:com.google.cast.media
not
Code:
urn:x-cast:plex
I just switched namespaces in my PlexController (as I built a custom LOAD message) to prove it would work

mcneishh said:
Ok I got the play working via Python.
I use this API - github.com/mjs7231/python-plexapi
The key things I had to do:
1. Grab a transient token for the request
Code:
server.query('/security/token?type=delegation&scope=all').attrib('token')
2. And I created a playQueue id for the request
Code:
server.createPlayQueue(video).playQueueID
3. The LOAD command must be run in the namespace:
Code:
urn:x-cast:com.google.cast.media
not
Code:
urn:x-cast:plex
I just switched namespaces in my PlexController (as I built a custom LOAD message) to prove it would work
Click to expand...
Click to collapse
Can you provide some more details on how you did the LOAD command part? That's the part I'm having the most trouble with.

Ah, I had NOT indeed worked out the transient token bit. I felt like maybe I needed to fetch one, but hadn't quite worked out how. Are you sending a SETSTREAM and a LOAD or just a LOAD to actually get things playing? If a SETSTREAM, is that going to the plex namespace or the media namespace?

linc-thra said:
Ah, I had NOT indeed worked out the transient token bit. I felt like maybe I needed to fetch one, but hadn't quite worked out how. Are you sending a SETSTREAM and a LOAD or just a LOAD to actually get things playing? If a SETSTREAM, is that going to the plex namespace or the media namespace?
Click to expand...
Click to collapse
How did you go about sending the commands to the chromecast? I've spent most of the day trying to figure out pychromecast, but I'm not having much luck. I just cannot figure out how to expand the namespace to add a new plex module. I feel like if I could get anything to send it would be a huge leap in the right direction...

MechaTech84 said:
How did you go about sending the commands to the chromecast? I've spent most of the day trying to figure out pychromecast, but I'm not having much luck. I just cannot figure out how to expand the namespace to add a new plex module. I feel like if I could get anything to send it would be a huge leap in the right direction...
Click to expand...
Click to collapse
I'm headed out to dinner and won't be back for a while, BUT, it requires editing the plex.py file in the controller folder of pychromecast. I JUST got it to start playing and the like myself thanks to mcneishh's hints. I'm attaching a basic functional PlexApiController:
http://pastebin.com/qeLYZpW4
I'll try to improve it later.
An example of how to use this:
Code:
import pychromecast.controllers.plexapi as px
import pychromecast
from plexapi.myplex import MyPlexAccount
account = MyPlexAccount.signin('<USERNAME>', '<PASSWORD')
plex = account.resource('<SERVER_NAME>').connect()
pxr = px.PlexController()
cast = pychromecast.Chromecast("<CHROMECASTIP")
cast.register_handler(pxr)
pxr.namespace = 'urn:x-cast:com.google.cast.sse'
white = plex.library.section("TV Shows").get("White Collar")
epi = white.seasons()[0].episodes()[0]
pxr.play_media(epi,plex)

My bad, that first code line should be
Code:
import pychromecast.controllers.plex as px
if you edit the existing plex.py file, I think. I had made my own at plexapi.py so as not to lose the original.

Is there a reason why you are trying to do this and not use the Plex App? Is it just a coding experiment or is there some reason why you want to bypass the Plex app?

Asphyx said:
Is there a reason why you are trying to do this and not use the Plex App? Is it just a coding experiment or is there some reason why you want to bypass the Plex app?
Click to expand...
Click to collapse
There is a reason. Now that this is working, I have tied it to my Google home without waiting a year for Plex to get their support sorted. I can now say, "Okay Google, watch Westworld season 1 episode 1" and it will start playing the appropriate episode on my Chromecast from Plex.

Ahhhh...Good reason!
I agree Plex Devs are pretty slow at keeping up with the world around it.

MechaTech84 said:
Can you provide some more details on how you did the LOAD command part? That's the part I'm having the most trouble with.
Click to expand...
Click to collapse
I grabbed the relevant byte code cleaning it up I ended up with:
Code:
{"type":"LOAD","requestId":481982064,"sessionId":"81c3b38d-b2f4-4c33-929a-5365af184d70","media":
{"contentId":"/library/metadata/105","streamType":"BUFFERED","contentType":"video","customData":
{"offset":0,"directPlay":true,"directStream":true,"subtitleSize":100,"audioBoost":100,"server":
{
"machineIdentifier":"9a35df949e05bc86d0aa792c56e3db68c0c36250","transcoderVideo":true,"transcoderVideoRemuxOnly":false,"transcoderAudio":true,"version":"1.1.4.2757","myPlexSubscription":true,"isVerifiedHostname":false,"protocol":"http","address":"10.1.3.200","port":"32400","accessToken":"transient-74cce00a-4048-4fcc-a571-38f2fd9a2acf"
},
"user":{"username":"XXXXXXXX"},
"containerKey":"/playQueues/1635?own=1&window=200"
}
},
"autoplay":true,"currentTime":0
}
I haven't finished the method but here's what I have all the variables (except the last 2) are currently hardcoded.
Code:
def play_item(self, key, content_data, play_data, server_data, user_data, access_token, play_queue_id):
key = "/library/metadata/105"
requestId = self._socket_client._request_id
sessionId = self._socket_client.session_id
play_data = {"offset":0,"directPlay":True,"directStream":True,"subtitleSize":100,"audioBoost":100}
server_data = {"machineIdentifier":"9a35df949e05bc86d0aa792c56e3db68c0c36250","transcoderVideo":True,"transcoderVideoRemuxOnly":False,"transcoderAudio":True,"version":"1.1.4.2757","myPlexSubscription":True,"isVerifiedHostname":False,"protocol":"http","address":"10.1.3.200","port":"32400"}
user_data = {"username":"XXXXXX"}
content_data = {"streamType":"BUFFERED","contentType":"video"}
msg = {MESSAGE_TYPE:TYPE_LOAD,'requestId':requestId,'sessionId':sessionId}
msg['media'] = {'contentId':key}
msg['media'].update(content_data)
msg['media']['customData'] = play_data.copy()
msg['media']['customData']['server'] = server_data.copy()
msg['media']['customData']['server']['accessToken'] = access_token
msg['media']['customData']['user'] = user_data.copy()
msg['media']['customData']['containerKey'] = '/playQueues/%s?own=1&window=200' % play_queue_id
msg.update({'autoplay':True, 'currentTime':0})
self.namespace = 'urn:x-cast:com.google.cast.media'
self.send_message(msg)
self.namesapce = 'urn:x-cast:plex'
Here's my full controller code.
I'm not 100% sure that I have the right session and request Ids, but assume they are the most likely to use.
Hopefully this helps.
Code:
MESSAGE_TYPE = 'type'
TYPE_SHOWDETAILS = 'SHOWDETAILS'
TYPE_LOAD = 'LOAD'
class MyPlexController(PlexController):
def __init__(self):
super().__init__()
def receive_message(self, message, data):
logging.info('PlexController: I received this message: {}'.format(data))
return True # indicate you handled this message
def send_message(self, data, inc_session_id=False, callback_function=None):
logging.info('PlexController: I send this message: {}'.format(data))
super().send_message(data, inc_session_id, callback_function)
def show_details(self, key, content_data, server_data, user_data, access_token):
key = "/library/metadata/105"
server_data = {"machineIdentifier":"9a35df949e05bc86d0aa792c56e3db68c0c36250","transcoderVideo":True,"transcoderVideoRemuxOnly":False,"transcoderAudio":True,"version":"1.1.4.2757","myPlexSubscription":True,"isVerifiedHostname":False,"protocol":"http","address":"10.1.3.200","port":"32400"}
user_data = {"username":"XXXXXX"}
content_data = {"streamType":"BUFFERED","contentType":"video"}
msg = {MESSAGE_TYPE:TYPE_SHOWDETAILS}
msg['media'] = {'contentId':key}
msg['media'].update(content_data)
msg['media']['customData'] = {}
msg['media']['customData']['server'] = server_data.copy()
msg['media']['customData']['server']['accessToken'] = access_token
msg['media']['customData']['user'] = user_data.copy()
self.send_message(msg)
# {"type":"SHOWDETAILS","media":
# {"contentId":"/library/metadata/105","streamType":"BUFFERED","contentType":"video","customData":
# {"server":
# {"machineIdentifier":"9a35df949e05bc86d0aa792c56e3db68c0c36250","transcoderVideo":true,"transcoderVideoRemuxOnly":false,"transcoderAudio":true,"version":"1.1.4.2757","myPlexSubscription":true,"isVerifiedHostname":false,"protocol":"http","address":"10.1.3.200","port":"32400","accessToken":"transient-73832b14-e2bf-4943-b97d-468b9ae85a34"},
# "user": {"username":"XXXXXX"}
# }
# }
# }
def play_item(self, key, content_data, play_data, server_data, user_data, access_token, play_queue_id):
key = "/library/metadata/105"
requestId = self._socket_client._request_id
sessionId = self._socket_client.session_id
play_data = {"offset":0,"directPlay":True,"directStream":True,"subtitleSize":100,"audioBoost":100}
server_data = {"machineIdentifier":"9a35df949e05bc86d0aa792c56e3db68c0c36250","transcoderVideo":True,"transcoderVideoRemuxOnly":False,"transcoderAudio":True,"version":"1.1.4.2757","myPlexSubscription":True,"isVerifiedHostname":False,"protocol":"http","address":"10.1.3.200","port":"32400"}
user_data = {"username":"XXXXXX"}
content_data = {"streamType":"BUFFERED","contentType":"video"}
msg = {MESSAGE_TYPE:TYPE_LOAD,'requestId':requestId,'sessionId':sessionId}
msg['media'] = {'contentId':key}
msg['media'].update(content_data)
msg['media']['customData'] = play_data.copy()
msg['media']['customData']['server'] = server_data.copy()
msg['media']['customData']['server']['accessToken'] = access_token
msg['media']['customData']['user'] = user_data.copy()
msg['media']['customData']['containerKey'] = '/playQueues/%s?own=1&window=200' % play_queue_id
msg.update({'autoplay':True, 'currentTime':0})
self.namespace = 'urn:x-cast:com.google.cast.media'
self.send_message(msg)
self.namesapce = 'urn:x-cast:plex'
# {"type":"LOAD","requestId":481982064,"sessionId":"81c3b38d-b2f4-4c33-929a-5365af184d70","media":
# {"contentId":"/library/metadata/105","streamType":"BUFFERED","contentType":"video","customData":
# {"offset":0,"directPlay":true,"directStream":true,"subtitleSize":100,"audioBoost":100,"server":
# {
# "machineIdentifier":"9a35df949e05bc86d0aa792c56e3db68c0c36250","transcoderVideo":true,"transcoderVideoRemuxOnly":false,"transcoderAudio":true,"version":"1.1.4.2757","myPlexSubscription":true,"isVerifiedHostname":false,"protocol":"http","address":"10.1.3.200","port":"32400","accessToken":"transient-74cce00a-4048-4fcc-a571-38f2fd9a2acf"
# },
# "user":{"username":"XXXXXX"},
# "containerKey":"/playQueues/1635?own=1&window=200"
# }
# },
# "autoplay":true,"currentTime":0
# }

linc-thra said:
Ah, I had NOT indeed worked out the transient token bit. I felt like maybe I needed to fetch one, but hadn't quite worked out how. Are you sending a SETSTREAM and a LOAD or just a LOAD to actually get things playing? If a SETSTREAM, is that going to the plex namespace or the media namespace?
Click to expand...
Click to collapse
I just used a LOAD.
For SETSTREAM I'm using the following in my controller (using the Plex namespace).
Code:
def _send_command(self, chromecast, command):
chromecast.register_handler(self)
mc = chromecast.media_controller
if mc.status is None or mc.status.media_session_id is None:
raise PlexControllerException('No media_session_id was found unable to send command {}'.format(command))
command['mediaSessionId'] = mc.status.media_session_id
self.send_message(command, inc_session_id=True)
def set_quality(self, chromecast, bitrate): self._send_command(chromecast, {"type":"SETQUALITY","bitrate":bitrate})
def set_subtitles(self, chromecast, subtitle_id): self._send_command(chromecast, {"type":"SETSTREAM","stream":{"type":"subtitles","id":subtitle_id}})
def disable_subtitles(self, chromecast): self._send_command(chromecast, {"type":"SETSTREAM","stream":{"type":"subtitles","id":0}})
def set_audio(self, chromecast, audio_id): self._send_command(chromecast, {"type":"SETSTREAM","stream":{"type":"audio","id":audio_id}})
def set_video(self, chromecast, video_id): self._send_command(chromecast, {"type":"SETSTREAM","stream":{"type":"video","id":video_id}})
You can get the resprective Ids from via the plexapi
Code:
videostreams = [s.id for s in video.videoStreams]
audiostreams = [s.id for s in video.audioStreams]
subtitlestreams = [s.id for s in video.subtitleStreams]

linc-thra said:
I'm headed out to dinner and won't be back for a while, BUT, it requires editing the plex.py file in the controller folder of pychromecast. I JUST got it to start playing and the like myself thanks to mcneishh's hints. I'm attaching a basic functional PlexApiController:
http://pastebin.com/qeLYZpW4
I'll try to improve it later.
An example of how to use this:
Code:
import pychromecast.controllers.plexapi as px
import pychromecast
from plexapi.myplex import MyPlexAccount
account = MyPlexAccount.signin('<USERNAME>', '<PASSWORD')
plex = account.resource('<SERVER_NAME>').connect()
pxr = px.PlexController()
cast = pychromecast.Chromecast("<CHROMECASTIP")
cast.register_handler(pxr)
pxr.namespace = 'urn:x-cast:com.google.cast.sse'
white = plex.library.section("TV Shows").get("White Collar")
epi = white.seasons()[0].episodes()[0]
pxr.play_media(epi,plex)
Click to expand...
Click to collapse
Hi, thanks a lot for your code! I managed to connect to the Chromecast using pychromecast and to plexapi, but unfortunately every time I try to play something I get "unable to cast this media is currently unavailable" on my Chromecast. Starting it manually works.
Do you have any ideas?

bluebird11 said:
Hi, thanks a lot for your code! I managed to connect to the Chromecast using pychromecast and to plexapi, but unfortunately every time I try to play something I get "unable to cast this media is currently unavailable" on my Chromecast. Starting it manually works.
Do you have any ideas?
Click to expand...
Click to collapse
Hmmm... not really, other than possibly you're calling or referencing the episode wrong from plexapi?

linc-thra said:
Hmmm... not really, other than possibly you're calling or referencing the episode wrong from plexapi?
Click to expand...
Click to collapse
Hmm, I'm getting it with the following code:
Code:
movies = plex.library.section('Movies')
for video in movies.search(unwatched=True):
print(video.title)
epi = plex.library.section('Movies').get(video.title)
break
Another question: Do I need to connect a client first? I.e. do I have to connect to Plex with a browser or the app before I can do anything?

bluebird11 said:
Hmm, I'm getting it with the following code:
Code:
movies = plex.library.section('Movies')
for video in movies.search(unwatched=True):
print(video.title)
epi = plex.library.section('Movies').get(video.title)
break
Another question: Do I need to connect a client first? I.e. do I have to connect to Plex with a browser or the app before I can do anything?
Click to expand...
Click to collapse
To answer your second question first: No, the controller should connect itself just find with no browser involved. The first question is more complicated... mainly because your code works for me.... so long as you are trying to get the first unwatched movie in the movie section. I didn't have any marked as "unwatched" to start with and it fell over, but once I marked one as unwatched, that code ran for me fine.

linc-thra said:
To answer your second question first: No, the controller should connect itself just find with no browser involved. The first question is more complicated... mainly because your code works for me.... so long as you are trying to get the first unwatched movie in the movie section. I didn't have any marked as "unwatched" to start with and it fell over, but once I marked one as unwatched, that code ran for me fine.
Click to expand...
Click to collapse
Thanks for the reply, it works now. Connecting directly to the plex server in the local network doesn't seem to work. What worked is connecting over plex.tv as shown here... I thought that it doesn't matter.
Anyway, what I was hoping for is that after connecting it would show up as a device / client in the Plex app so I could control it from there (and from amazon echo), but it doesn't show up Do you think that would be possible? If I connect manually from a browser it shows up as "Plex Web (Chrome)".

Related

[APP] myMedia WP7

Hi all,
myMedia WP7 has recently been released on the marketplace. myMedia WP7 is a TVersity client that allows you to stream music and video (and view pictures) from your TVersity server to your WP7 device.
The server handles all the transcoding (if required), so all videos formats are playable on your phone. For Tversity to properly identify your WP7 device you need to update the included profiles file. Instructions and the profile is available from here http://www.gordonhome.info/?p=198
myMedia WP7 has a fully functional trial mode (ad-supported) or is $1.99 US for the non-ad version.
You can get is here (Zune link) http://social.zune.net/redirect?type=phoneApp&id=27cacd23-1e94-e011-986b-78e7d1fa76f8
A video of it in action
http://www.youtube.com/watch?v=S2OB_Om4BWc
Please post app recommendations in WP7 General.
~~Tito~~
Sounds cool. When I have a bit of time to setup Tversity, I think I will give this a go!
I already had TVersity and DynDNS installed (for separate reasons) so I set up myMedia and it works flawlessly both over my home network and from the external address.
Very nice, I can confirm the trial is fully functional & works flawlessly once you have TVersity & DynDNS (Needed if you don't have a static External IP, which most ISP's don't use) setup.
Could you explain setup using dns a little more? Also, should you not need to use a dns ip if you're just trying to use tversity with mymedia wp7 on your home network (connected through wifi)? Thanks.
Ok, got it working on home network. Now just trying to get it set up with port forwarding and using dns server.
kwill said:
Could you explain setup using dns a little more? Also, should you not need to use a dns ip if you're just trying to use tversity with mymedia wp7 on your home network (connected through wifi)? Thanks.
Click to expand...
Click to collapse
Yes, you don't need to use a DNS service on your home network (or if your ISP provides a static IP address). You just put in the IP address of your tversity server.
kwill said:
Ok, got it working on home network. Now just trying to get it set up with port forwarding and using dns server.
Click to expand...
Click to collapse
Great, let me know if you need any assistance setting up the DNS/external access portion.
Hi,
I have everything set up including the profiles file but am unable to find windows phone 7 in the dropdown list in settings - media playback device within tversity. this seems to result in every video file being unsupported when trying to stream them from my device. ány idea what i can try to resolve this please?
pencilcase said:
Hi,
I have everything set up including the profiles file but am unable to find windows phone 7 in the dropdown list in settings - media playback device within tversity. this seems to result in every video file being unsupported when trying to stream them from my device. ány idea what i can try to resolve this please?
Click to expand...
Click to collapse
It doesn't appear in the drop down settings (that's not what the profile does), it's automatically detected based on browser strings. The Mango Beta has thrown a spanner in the works by changing the browser string so WP7 is no longer automatically detected.
I've submitted an updated version to the marketplace that lets you force tversity to use a specific profile. By choosing this option and putting in the profile GUID (it defaults to the GUID of the WP7 profile I provide), you can force tversity to use whatever profile you want regardless of the auto detection.
Hi,
unfortunately this update did not resolve the issue.
It seems to recognize it as a Windows Phone 7 now, but Tversity is telling me: Error - Could not strart transcoding for file://.................avi
nevermind that, fixed, all working ! thanks !!!!!!!!!!
I got everything running but when I try to play a movie it gives an error... ''Sorry, can't play this file''... Or something like that...
Any ideas...?
I'd like a new icon for this app.
Sent from my Samsung Omnia 7 using XDA Windows Phone 7 App
BellPego said:
I got everything running but when I try to play a movie it gives an error... ''Sorry, can't play this file''... Or something like that...
Any ideas...?
Click to expand...
Click to collapse
It's not transcoding the file
1. Did you install the profile?
2. If so, is the device being identified as a WP7 device?
3. If you're using Mango, turn the force profile detection on in the settings page.
Peew971 said:
I'd like a new icon for this app.
Click to expand...
Click to collapse
I'd like a billion dollars. I take it you're a designer and are offering to design one...
I'm not, I'm a consumer offering feedback. Isn't it why you post here, for feedback? I send feedback to plenty of devs and never had an answer like yours, I'm really unimpressed.
Sent from my Samsung Omnia 7 using XDA Windows Phone 7 App
dgaust said:
It's not transcoding the file
1. Did you install the profile?
2. If so, is the device being identified as a WP7 device?
3. If you're using Mango, turn the force profile detection on in the settings page.
Click to expand...
Click to collapse
I did that and it was a bit laggy...
Then and played aroun and found the best settings in my case...
Media Playback Device: WMV9 Video Device.
Leave the IP address blank
I have turned off HTTP Proxy.
On the Transcoder Tab
When To Transcode: Always (Important)
Mine is set to Decrease Bitrate if its too high for my network
And ticked Use DirectShow for Windows Media Encoding and choose Windows Media Video 9 in the drop down menu...
Now everything works fine in Mango...
Peew971 said:
I'm not, I'm a consumer offering feedback. Isn't it why you post here, for feedback? I send feedback to plenty of devs and never had an answer like yours, I'm really unimpressed.
Sent from my Samsung Omnia 7 using XDA Windows Phone 7 App
Click to expand...
Click to collapse
If that's the type of 'constructive' feedback you offer to developers, then I'm sure your feedback is ignored.
'I'd like a new icon for this app' is not constructive and provides no insight into what you feel is wrong with the current icon, or what could be done to improve it. Not only that, the tone of the post is arrogant and rude.
Most developers would ignore comments like those. Fortunately I don't make my living off this type of stuff so I can say what I want, how I want. In general, I'm courteous and will do everything to help out a user and work through any issues they have. On occasion, I'll talk to people in the same manner they chose to address me.
For anyone who wants to suggest genuine features or has requests for changes, I'm happy to listen. In fact, I've made a number of additions and changes based on user feedback.
I've also spent significant time assisting users setup tversity so they get the best experience using the app.
Peew971, in order to avoid feeling disappointed in future, I'd reconsider how you leave 'feedback'.
BellPego said:
I did that and it was a bit laggy...
Then and played aroun and found the best settings in my case...
Media Playback Device: WMV9 Video Device.
Leave the IP address blank
I have turned off HTTP Proxy.
On the Transcoder Tab
When To Transcode: Always (Important)
Mine is set to Decrease Bitrate if its too high for my network
And ticked Use DirectShow for Windows Media Encoding and choose Windows Media Video 9 in the drop down menu...
Now everything works fine in Mango...
Click to expand...
Click to collapse
BellPego,
Glad you got it streaming for you. Just a note though, that if you use those settings and have other devices it'll also affect playback on those devices.
Personally, my settings are
Mediaplayback Device
Automatic
Transcoder
Only when needed
decrease bitrate
Windows Media Encoder
Tick use directshow
Windows Media Video 9
Optimization
Quality
Compression
Average
When you insert the WP7 profile into the TVersity profiles.xml file (this will automatically be included in the next build of TVersity), and in Mango turn on the force profile detection, it will detect that the device is a Windows Phone 7 and transcode accordingly.
dgaust said:
Peew971, in order to avoid feeling disappointed in future, I'd reconsider how you leave 'feedback'.
Click to expand...
Click to collapse
Wow, I said "I'd like a new icon for this app", not one more word. What is it I should reconsider, was I disrespectful to you or your work? Alright I just typed a quick sentence from my phone and didn't elaborate but I didn't deserve that sarcastic answer of yours.
I've been praising your app to friends and users here and elsewhere and that's how you address me because I said "I'd like a new icon for this app"?! This takes me back to those bad times with Dinik on the HD2 forums, talented guy but I couldn't force myself to support his work anymore after some odd posts of his.
Just... wow.
dgaust said:
I'd like a billion dollars. I take it you're a designer and are offering to design one...
Click to expand...
Click to collapse
Icons attached;

[DEV] Intercept chromecast whitelist with MITM (and update)

Hi All,
I've just managed to successfully intercept and change the whitelist for a flashed chromecast.
Steps:
Load custom cert onto device (replace nssdb with custom one) - nssdb I used and certs available here https://mega.co.nz/#!05wmDR4T!OMkBXwfO9D1wktt2bQpSwjNZ_Y9PB8q_Ryk3zSx4k1c
Load MITM on a linux host, route default gateway at linux host.
Route just google range towards MITM (so nothing else gets caught and just gets redirected)
iptables -t nat -A PREROUTING -p tcp -s 192.168.178.146 -m iprange --dst-range 74.125.237.0-74.125.237.255 -j REDIRECT --to-port 8080
load mitmproxy with
"mitmproxy -T --host -s chromefree.py"
chromefree.py is available https://mega.co.nz/#!doJX1YDS!TT3lolbgXta24QOpbj40PBAYRetZkH1s9cIvQBslBN8
note that chromefree.py refrences json.dat (which requires a gzip'd json file)
example json files are available here https://mega.co.nz/#!ghwAEI7D!a-HwECm4w_8XKfdaaZOLgFrVTx9B8xLMOYJchi1PAUY
(with this I redirected youtube to a local news site, so attempting to cast to youtube pulls up stuff.co.nz)
Appears to work well, here's a picture of my TV running the revision 3 app
http://i.imgur.com/nhLI0oC.jpg
While I applaud this news, this could likely be the reason why Google has been slow to throw the doors open. The big name media providers are probably really leaning on Google to make sure these kinds of hacks can't possibly take place.
While everyone knows that no system is infallible, I'm sure that Google is under pressure to make sure that the device is as airtight as it can possibly be, and then some, before permitting the SDK to be formally released to the public.
mkhopper said:
While I applaud this news, this could likely be the reason why Google has been slow to throw the doors open. The big name media providers are probably really leaning on Google to make sure these kinds of hacks can't possibly take place.
While everyone knows that no system is infallible, I'm sure that Google is under pressure to make sure that the device is as airtight as it can possibly be, and then some, before permitting the SDK to be formally released to the public.
Click to expand...
Click to collapse
Do you really think that people would be spending so much time trying to circumvent the whitelisting if the content was available from the get go. I was very optimistic at the start but losing patience now. I bought three and was ready to buy more, but will wait and see what happens. Don't want to invest more money and time into something that might not have a future. It is sad because it has the unprecedented potential for so many different uses.
Can this be dumbed down for the newbs
ramirez3805 said:
Can this be dumbed down for the newbs
Click to expand...
Click to collapse
I plan to have a service available for rooted chromecast in the next few days that allows access to non-google approved applications.
Kyonz said:
I plan to have a service available for rooted chromecast in the next few days that allows access to non-google approved applications.
Click to expand...
Click to collapse
Cant wait!!!:good:
networx2002 said:
Cant wait!!!:good:
Click to expand...
Click to collapse
You don't have to! I just released last night http://forum.xda-developers.com/showthread.php?t=2516164
Kyonz said:
Appears to work well, here's a picture of my TV running the revision 3 app
http://i.imgur.com/nhLI0oC.jpg
Click to expand...
Click to collapse
What did you use as the sender app?
so i have a question how do you load up an app for use in chromecast now that i have done this ? sorry for sounding so noobish but just wondering.
ahecht said:
What did you use as the sender app?
Click to expand...
Click to collapse
I used the demo html app sender to launch it (sorry not entirely sure on the name as I haven't started developing for chromecast yet). I'd really like to see someone try to reverse engineer the data that the receivers require and build apps out for these though.
BurnOmatic said:
so i have a question how do you load up an app for use in chromecast now that i have done this ? sorry for sounding so noobish but just wondering.
Click to expand...
Click to collapse
This really is a DEV thread in that it provided the exploit for chromecast, app launching would be through the demo dev apps - please check out Kyocast (http://forum.xda-developers.com/showthread.php?t=2516164) if you haven't and note that there are better things coming
Kyonz said:
I used the demo html app sender to launch it (sorry not entirely sure on the name as I haven't started developing for chromecast yet). I'd really like to see someone try to reverse engineer the data that the receivers require and build apps out for these though.
Click to expand...
Click to collapse
I must be dense, as I can't make heads or tails of the Chromecast API (I usually can't understand Google's documentation for the Android API either, but there are plenty of third-party resources for that). What do you use for Launch Parameters in the demo app?
Which boot loader number is vulnerable ? I can#t find the infos :/
12alex21 said:
Which boot loader number is vulnerable ? I can#t find the infos :/
Click to expand...
Click to collapse
Only build 12072 has a vulnerable bootloader. You have to boot into the stock OS and set the Chromecast up (on a Wi-Fi network which doesn't connect to the internet or else it will update automatically) to check the build number.

Gear To Device Communication

Hi All,
I'm very new to app development. I have created an app on my Note3 and a client on the Gear but im not sure how to get them talking. Does any one know if there is a Samsung api for doing this or can I just use BLE. Also does any one have a good BLE tutorial?
Thanks in advance.
taylordw said:
Hi All,
I'm very new to app development. I have created an app on my Note3 and a client on the Gear but im not sure how to get them talking. Does any one know if there is a Samsung api for doing this or can I just use BLE. Also does any one have a good BLE tutorial?
Thanks in advance.
Click to expand...
Click to collapse
We are still waiting for sdk to be released
taylordw said:
Hi All,
I'm very new to app development. I have created an app on my Note3 and a client on the Gear but im not sure how to get them talking. Does any one know if there is a Samsung api for doing this or can I just use BLE. Also does any one have a good BLE tutorial?
Thanks in advance.
Click to expand...
Click to collapse
I don't see how you could use Bluetooth protocols for this kind of architecture. You can try to open a Bluetoothsocket and use your own script language to do the talking. http://developer.android.com/reference/android/bluetooth/BluetoothSocket.html
But I would wait for a SDK. Sony also has a SDK for their watches. It makes developing a lot easier with intent-based APIs
BluetoothSocket
appelflap said:
I don't see how you could use Bluetooth protocols for this kind of architecture. You can try to open a Bluetoothsocket and use your own script language to do the talking.
But I would wait for a SDK. Sony also has a SDK for their watches. It makes developing a lot easier with intent-based APIs
Click to expand...
Click to collapse
Thanks for the pointer, that works! :good:
On the watch:
Code:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothServerSocket bss = btAdapter.listenUsingRfcommWithServiceRecord("Test", UUID.fromString("c3f10dc0-677b-11e3-949a-0800200c9a66"));
BluetoothSocket bs = bss.accept();
byte[] buf = new byte[1024];
InputStream is = bs.getInputStream();
int read = is.read(buf);
is.close();
bs.close();
On the phone:
Code:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> devices = btAdapter.getBondedDevices();
BluetoothDevice device = devices.iterator().next();
BluetoothSocket bs = device.createRfcommSocketToServiceRecord(UUID.fromString("c3f10dc0-677b-11e3-949a-0800200c9a66"));
bs.connect();
bs.getOutputStream().write("Hello!".getBytes("UTF-8"));
bs.getOutputStream().flush();
bs.getOutputStream().close();
bs.close();
This is just an example, but it works. Does anyone know if the the Bluetooth GATT APIs might be a better fit, and whether they might be able to control the lifecycle of the app on the watch?
Data Transfer between Samsung Galaxy Note 3 and Samsung Galaxy Gear?
surlydre said:
Thanks for the pointer, that works! :good:
On the watch:
Code:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothServerSocket bss = btAdapter.listenUsingRfcommWithServiceRecord("Test", UUID.fromString("c3f10dc0-677b-11e3-949a-0800200c9a66"));
BluetoothSocket bs = bss.accept();
byte[] buf = new byte[1024];
InputStream is = bs.getInputStream();
int read = is.read(buf);
is.close();
bs.close();
On the phone:
Code:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> devices = btAdapter.getBondedDevices();
BluetoothDevice device = devices.iterator().next();
BluetoothSocket bs = device.createRfcommSocketToServiceRecord(UUID.fromString("c3f10dc0-677b-11e3-949a-0800200c9a66"));
bs.connect();
bs.getOutputStream().write("Hello!".getBytes("UTF-8"));
bs.getOutputStream().flush();
bs.getOutputStream().close();
bs.close();
This is just an example, but it works. Does anyone know if the the Bluetooth GATT APIs might be a better fit, and whether they might be able to control the lifecycle of the app on the watch?
Click to expand...
Click to collapse
Did you succeed in getting the Note 3 and Gear talking with this code, Is data transfer also possible? When I tried deploying such a client application on the watch it immediately crashed and so I thought it could be that the Bluetooth session cannot be started because of an existing Bluetooth connection via the Gear Manager.
After reading some content on different sites regarding this(I could not post those links as I got an error while posting), I thought real time data transfer via Bluetooth will not be possible but if you say it works then may be I should check my code, But is there any other way to transfer data by using the existing Bluetooth pairing via the Gear Manager App?

Auto Voice Room ID chain (kodi, tasker)

Hi
Im a fairly new Tasker User. I have done quite a lot of things with tasker but I definitely need a lot more practice.
Im trying to figure out how to specify a room ID inside of a voice command and have tasker execute an action based on what say.
EXAMPLE-- I want to be able to control a specific KODI host (android box in my bedroom) like this:
1. Say "Play %movie "
2. Have tasker ask me "in what room?"
3. I say "bedroom"
4. then have tasker play the specifed movie in the specified room
or
1. say "Play %movie" in the bedroom
2 have tasker know which device i am talking about and what room its in
my questions are
-- How do you set a room ID so that tasker knows when i say "bedroom" it knows whats in the room to play?
-- how do i link devices (ie my kodi android box) to specific rooms
--- finally how do i set a profile that allows me to specify the room inside of an active profile and have tasker act upon it inside that profile
How exactly are you controlling Kodi?
svampsson said:
How exactly are you controlling Kodi?
Click to expand...
Click to collapse
Sorry didn't know you replied
I am currently using yatse but I'm open to using any method at this point. My hopes are to use multiple android boxes with kodi installed thoughout my house and play movies on my NAS drive in what ever room I specify via tasker/autovoice
Sent from my SM-N930T using Tapatalk
homelogicatl said:
Sorry didn't know you replied
I am currently using yatse but I'm open to using any method at this point. My hopes are to use multiple android boxes with kodi installed thoughout my house and play movies on my NAS drive in what ever room I specify via tasker/autovoice
Sent from my SM-N930T using Tapatalk
Click to expand...
Click to collapse
Do you have a working way of playing the movie of your choice through Yatse? In that case it's possible to do the rest.
Otherwise there are some options, the
AutoWeb (Beta Link, Community Link, Play Store link) Kodi API for example. But I don't know if that can be setup to work on several machines.
svampsson said:
Do you have a working way of playing the movie of your choice through Yatse? In that case it's possible to do the rest.
Otherwise there are some options, the
AutoWeb (Beta Link, Community Link, Play Store link) Kodi API for example. But I don't know if that can be setup to work on several machines.
Click to expand...
Click to collapse
Yes. Yaste has a way to use autovoice to say any movie scanned into your library using a phone to control a kodi host. I have already accomplished this part using YouTube videos and forums
I know it's possible to do what I want to do. I just lack the knowledge to do it myself
I'm guessing I would need to use the yatse host manager plugin to select which host(room) I would like to control using a shell script that triggers when I use a room name then somehow use autoremote to sent the voice command. AFTER the host (room)has been selected.
If you're using AutoRemote you can rename your devices. If you use sender: By Name with a variable for Recipient Name you can control anything by calling the device's name.
Hope it helps.
FourQ said:
If you're using AutoRemote you can rename your devices. If you use sender: By Name with a variable for Recipient Name you can control anything by calling the device's name.
Hope it helps.
Click to expand...
Click to collapse
If I use autoinput. How do I make the profile so it selects the host BEFORE. It sends the movie query?

Play Music (url) from Time A to Time B every day

Hello there folks!
First post here, believe me I've search through all the internets and this forum searching for a solution to this and I can't find it, so maybe I'm approaching this problem in a wrong way, let's see if the gurus around here can give me a hand.
I am looking for a way to play music from an url from 8 to 22 every day. I am trying this on an Android machine that is not a phone. It has Android Version 7.1.2 and Kernel Version 3.14.29.
What I'm doing at the moment is launching Chrome with the url in the DATA field in a task, and launching that task with a profile at 8h, then using the Media Control pausing it at 22h, and the next day at 8 launching again Chrome with the url in the DATA field. I tried to play again using the Media Control but I think after a few minutes Chrome closes the connection and it's not possible to play again, you have to reload.
This way of doing things brings a problem: Chrome always will open in a new tab, so after a week I'll have 7 tabs open in Chrome. Checking the "Always start a new copy" field does nothing in this regard. Also my device is not rooted so I can't kill Chrome, however I am not sure if I was able to kill it, if it would still open the last session with all the previous tabs, not solving the problem anyway. I am willing to root the device but it seems not being a commercial phone it's not a trivial task, some apps don't work and if it won't solve anything it'd be a waste of time.
Things that I've tried but haven't been able to achieve: close tabs, open Chrome from Tasker in Incognito Mode. Using Autoinput for this things seem to not work, or I think I may not have the right code for what Autoinput should look for. I've tried to use VLC to open the url because maybe I would solve the multitab problem and maybe I could just play and pause forever without being forced to relaunch. But VLC for Android doesn't seem to care if you tell it to open an url from Tasker.
So questions, do you guys think there would be a better approach for this? Chrome is not meant for playing music but it seemed like the easiest way to get the job done, giving that VLC is too simple in Android to manage urls. Maybe there's an app that would just do this and I'm going crazy for no reason.
A part B of the problem that would be great if I had some input is that I should monitor the network and the music so when it stops between 8 and 22 I do something. For instance, if it stops and the connection is down I'd play something from a folder, and whenever the connection is back I'd switch to the url again. My first approach to this is to check the Network and make a if_else routine doing changes. This routine runs infinitely through a GoTo at the end of it. If I'm not mistaken that's the only way in Tasker to check for instant changes in the Network (this device is connected through cable, not WiFi) since Tasker only checks changes every 2 minutes. If there is another way of doing this it'd be great to know, the machine seems to suffer a bit when I run this task.
Besides checking the Network I've also tried the Is Music Playing plugin but still with no success. Maybe it won't work with Chrome? I still have to invest some time on this, but there's not a lot of documentation available I believe.
Well, sorry for the long post! I'd be great to have some advice, I'm going a bit crazy doing something that it's probably basic. I am a newbie with this.
Thanks a lot!
Try using a "system -> send intent" action to launch the url instead.
A1: Send Intent [
Action: android.intent.action.VIEW
Cat: None
Mime Type:
Data: https://google.com
Extra: com.android.browser.application_id:music
Extra:
Package:
Class:
Target: Activity
On the "Extra:" line, notice the "music". That is giving a label to the window and most modern browsers (tested on Firefox) will then reuse that window.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
And to follow-up on the second part of your question, where you want to know if the streaming stops....
There is a thread on the tasker google group discussing a variety of monitor network usage options. I think that is the easiest way to determine if streaming has stopped.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Thanks a lot ktmom! I've done exactly what you said and I searching about it I see it's been recommended for similar purposes on other forums. But it doesn't work for me, I'm just able to open chrome but it seems to ignore the url. Any ideas? This machine won't allow me to install Firefox, although I can install Firefox Focus, in case that could help.
I'm going to check out now the network thread, thanks a lot!
Try whatever other browser you can. Is webview installed? I'm not sure if it matters though.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
I think I experimented before with some incognito mode stuff and that was interfering with the routine. Now seems to work like a charm! Thanks a lot!
About the Network management, here's what I've done, maybe I'm a bit basic but I understand this better than what the guys are talking about in the other thread. If you find it doesn't have something that could potentially crash Android or damage somehow the working of the machine in general, or it's improvable, I'm all ears. I know I'm not the best on this stuff:
Test Net
Type Connection Type Store Result in %NETSTATUS // Check the connection
If %NETSTATUS eq ethernet & %FLAG eq 1 // If there were a connection and there's still a connection, do nothing
Wait 1ms
End If
If %NETSTATUS eq ethernet & %FLAG eq 0 // If the machine were offline and the ethernet cable is reconnected
Music Play Dir
Dir Music Subdirs Off Audio Only On Random On // Stop offline music. For some reason this works well for stopping the offline music, whereas the Media Stop only works the first time
Send Intent
Action android.intent.action.VIEW // This is the sweet code you gave me
Variable Set
Name %FLAG to 1
End If
If %NETSTATUS eq none & %FLAG eq 1 // If there were a connection but there's not anymore
Media Control Cmd Pause Simulate Media Button On App Chrome // Pause streaming so it doesn't overlap the offline music
Dir Music Subdirs Off Audio Only On Random On // Play offline music
Music Play Dir
Variable Set
Name %FLAG to 0
End If
If %NETSTATUS eq none & %FLAG eq 0 // If there were not a connection and there's still no connection, do nothing
Variable Set
Name %FLAG To 0
Goto
Type Action Number Number 1
--
One thing I see about this is that it's an infinite loop and may cause some suffering to the machine.
Now I'll see how to add WiFi to the routine and I'd like to check how to do something when the music stop in general.
Thanks a lot for your time!

Categories

Resources