Transcoding
|
Posts: 22
Threads: 1
Joined: Oct 2015
[Solved]
Nov 06, 2015, 07:37 PM
(Nov 06, 2015, 05:19 PM)Mike Wrote: Thanks @tragidy, I don't know how frequently the plex.js is updated which will affect which method is optimal (including the modified script in your repo or modifying it on the fly with new versions). Each has its limitations and I'm sure you'll figure out which is easiest for you to maintain.
I got the Chromecast today so I can start helping you guys. We just need @lukas to elaborate what he used the Google Chromecast SDK for to get his workaround. I'd also like to understand why he must cast from Google Chrome and cannot do so from Android app.
Lukas if you just provide a general explanation of what you did then I'm sure we can reproduce it. I believe you changed the App ID and altered the plex.js the index.html in the Chromecast app points using the SDK but somehow this is different from rebuilding the Plex Chromecast app?
@Mike served static .js wont be optimal for certain, I'll offer rewrites which would be cleaner in almost any case until they change the script up.
I put it on GIT mainly for people to fork it and do as they like too, but scripted rewrites would be better I agree, I'll go for that in update
How about using apk tool on current plex http://ibotpeaches.github.io/Apktool/ any gain we can have with such tinkering? I mean is the app plain text inside? I've not even looked.
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Solved]
Nov 06, 2015, 08:31 PM
(This post was last modified: Nov 06, 2015, 09:05 PM by Mike.)
@tragidy, apk tool could be useful. I'm not able to get it to run on Windows 10 but may try Ubuntu later.
Here is the dumped apk zipped so you can have a peek if the apktool works for you.
Based on the other tutorial the chromecast app appears to just be an index.html file, I believe the same index.html file is in the Plex android app and it should be modifiable there too and we can point to the dummy web server
Posts: 22
Threads: 1
Joined: Oct 2015
[Solved]
Nov 06, 2015, 09:42 PM
(This post was last modified: Nov 06, 2015, 09:47 PM by tragidy.
Edit Reason: decoded
)
@Mike lots of files inside I just peeked with 7zip
Code:
O:\apktool>apktool d plex.apk
I: Using Apktool 2.0.2 on plex.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Justin\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
O:\apktool>
I updated the script to do rewrites as well.
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Solved]
Nov 06, 2015, 10:15 PM
(This post was last modified: Nov 06, 2015, 11:28 PM by Mike.)
Cool, I figured out how to use the apktool (just read the instructions edit: see you did too @lukas) and here is the new dump
@lukas, in that dump there is a public.xml file where you can specify the app ID for chromecast, maybe try pointing that to your custom one?
Code:
<public type="string" name="chromecast_app_id_preference_title" id="0x7f0a02e9" />
You may need to adjust the vaules in arrays.xml too
Code:
<string-array name="prefs_chromecast_appid_values">
<item>9AC194DC</item>
<item>4289C4E0</item>
<item></item>
Then after modifying the last 8 characters to your custom app ID, rebuild the apk like this specifying the base folder which is also called base (apktool.bat and apktool.jar need to be in the same directory or in a directory part of the PATH environment variable)
@lukas, you can alkso jsut tell me the 8 charactr app ID you are using and I can try and build it for you and post it here so you can test it
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Solved]
Nov 06, 2015, 11:32 PM
@tragidy one more adjusment for the plex script, the hosts file has to be modified after the js files are grabbed (otherwise it is looking to the Raspberry Pi for them - I made the same mistake initially)
Also you can automate the ip to be used in /etc/hosts with this command - maybe set it as default
Code:
showip=$(ifconfig eth0 | awk -F"[: ]+" '/inet addr:/ {print $4}')
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Solved]
Nov 06, 2015, 11:40 PM
(This post was last modified: Nov 07, 2015, 11:13 PM by Mike.
Edit Reason: Meant to ask lukas, sorry for confusion tragidy
)
@lukas, can you show your custom index.html for the chromecast app so we can see where you put the modified plex.js
Code:
<html lang="en">
<head>
<title>Plex</title>
<meta charset="utf-8">
<link rel="stylesheet" href="/qa/css/main.6f961e1ee1c9352ebd0786bf3efdc354.css">
</head>
<body>
<div class="app-container">
<img class="plex-logo-loading" src="img/base/plex-logo.svg">
<div id="loading" class="loading loading-lg loading-inline"></div>
</div>
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script><script src="/qa/js/vendors.0707896ac17ec7e27286.js"></script><script src="/qa/js/main.6553d4ecd867e69ec2d6.js"></script></body></html>
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Solved]
Nov 07, 2015, 12:46 AM
(This post was last modified: Nov 07, 2015, 12:54 AM by Mike.)
Alright, I finally tested and it's working. This actually will use the non-chromecast plex.js which is in the local web server. The chromecast app I uploaded was this and I had to have the Google Cast extension installed and streamed from the plex server's web interface (not plex.tv), so I am pretty sure the code below is wrong.
Code:
<html lang="en">
<head>
<title>Plex</title>
<meta charset="utf-8">
<script id="plex-script" src="http://192.168.40.106/production/js/plex.js"></script>
<link rel="stylesheet" href="http://chromecast.plex.tv/production/css/main.css">
</head>
<body>
<div class="app-container">
<img class="plex-logo-loading" src="http://chromecast.plex.tv/qa/img/base/plex-logo.svg">
<div id="loading" class="loading loading-lg loading-inline"></div>
</div>
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script><script src="/qa/js/vendors.0707896ac17ec7e27286.js"></script><script src="/qa/js/main.6553d4ecd867e69ec2d6.js"></script></body></html>
Posts: 16
Threads: 1
Joined: Nov 2015
Reputation:
5
[Solved]
Nov 07, 2015, 05:27 AM
(This post was last modified: Nov 07, 2015, 05:35 AM by lukas.)
Hi Mike & tragidy,
Apktool was what I was playing around with the last few days.
I also found the xml file where you can specify the Production, QA and Custom App ID. There is even a hidden setting in the Advanced menu (if you enable the beta mode), where you can switch between these three values and specify the Custom App ID in the app (without hardcoding it).
However, it seemed like this function was only used for testing and is not used anymore in the app.
For me it helped to modify the following file:
\smali\com\plexapp\plex\application
Code:
.line 287
sget-object v0, Lcom/plexapp/plex/application/ak;->g:Lcom/plexapp/plex/application/d/k;
const-string v1, "9AC194DC"
Replace 9AC194DC with your own App ID and it should work.
Will write more detailed instructions today or tomorrow.
Posts: 24
Threads: 3
Joined: Oct 2015
Reputation:
0
[Solved]
Nov 07, 2015, 09:25 AM
Guys, I've read all topic and this seems very good, but you are talking a way too hard for me to follow you. I hope someone (good Mike maybe?=) will post a guide for pepople, when you wizards come to a definitive solution
Keep on doing your magics, I'll follow with interest! Then I'll be available for making tests on my BPI for others.
Posts: 16
Threads: 1
Joined: Nov 2015
Reputation:
5
[Solved]
Nov 07, 2015, 11:09 AM
(This post was last modified: Nov 08, 2015, 09:21 AM by lukas.)
Sorry guys, I am a bit rushed. I just managed to write quickly some instructions of what I did.
I will try to make it a bit more detailed in the coming days.
There might be still some errors in the instructions. Let me know if you encounter any errors and I will troubleshoot and modify the tutorial.
The Google Chromecast Plex app connects to a landing page on the Plex servers ( http://chromecast.plex.tv/production/index.html). This landing page contains a copy of the plex.js file, which checks whether your Chromecast is able to transcode videos or not.
In order to override the plex.js file with a modified version, you will have to create your own Chromecast app, which points to a modified version of the landing page. Afterwards, the PMS HTML files and the Android app have has to be modified so that they point to your own Chromecast app instead of the Plex app.
The normal Plex app points to the official Chromecast landing site. However, the attached beta version, which cannot be found in the Play store, allows to specify an own Chromecast App ID. If there are any updates, they can be automatically downloaded from within the Plex app.
Requirements
- Google Chromecast SDK account or $5 to register for it (see below)
- Web server (e.g. on your Raspberry Pi)
- WinSCP to upload files to you your Raspberry Pi (if you are using it as a web server)
Debugging on your Android phone
ADB drivers
- The following two files:
1) Plex (beta) for Android:
http://www34.zippyshare.com/v/722qTKB5/file.html
2) A copy of the Plex chromecast landing site:
plex_chromecast_landing_page.zip (Size: 499.99 KB / Downloads: 45)
1. Whitelist your Chromecast device
In order to use Chromecast apps that are not published, you will have to activate your device for testing.
- Visit the following website https://cast.google.com/publish/#/overview
- Register for access to the SDK (5 USD) or log in, if you have access already
- Click on "Add new device"
- If you are using the Chrome browser, just click the "Cast" button and cast the website to your Chromecast (it should give you the serial number of your Chromecast). Alternatively, you can find the serial number on your device.
- Enter the serial number and a description and add the device.
- Wait for 15 minutes and reboot the Chromecast.
2. Install a web server on your Raspberry Pi
I will add this section later. Instructions can be also found in the posts of tragidy and Mike.
3. Create your own Chromecast App
If you have an existing web server of webspace somewhere, these steps might be slightly different.
The version of the landing page attached is a copy from the original landing page. However, I have modified the plex.js file so that the transcoding validation is disabled.
- Use WinSCP to connect to your Raspberry Pi.
- Navigate to the folder that contains the web server content (e.g. /var/www/html/)
- Create a new folder (e.g. plex)
- Upload the Chromecast landing page to the new folder (plex_chromecast_landing_page.zip).
- Verify that the web server is working by opening the URL in a browser: http://YOUR.RASPBERRY.PI.IP/plex/
- Visit the Google Cast SDK: https://cast.google.com/publish/#/overview
- Click on "Add new Application"
- Choose "Custom Receiver"
- Enter "Plex" as name and the URL from above as Receiver Application URL
- Add the application and note down your application ID. This should be a mixture of 8 characters and digits.
4. Modify your PMS plex.js
This step is required to enable the Google Chrome browser to connect to your own Chromecast App Id.
- Use putty to connect to your Raspberry Pi. If you installed WinSCP, you can just use WinSCP to make it easier. However, note, that you will have to know the path of your plex.js file.
- Find the path of your plex.js file:
Code:
sudo find / -name plex.js
- Change to the folder that contains the plex.js file. In my example, the file is in the folder /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/WebClient.bundle/Contents/Resources/js. Depending on the PMS version, this path might be different.
Code:
cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/WebClient.bundle/Contents/Resources/js
- Open the file in an editor:
- Press Ctrl+W and search for the following value:
- Change the value to your own Chromecast App ID. Press Ctrl+X, Y and Enter to save the modified plex.js.
5. Install the Plex beta app (Android)
This step is probably the most tricky part. The Chromecast App ID is hardcoded in the Plex app. So we have to decompile the APK file, change the ID, and re-compile it.
The beta versions of Plex allow the user to enter a custom Chromecast App ID. Since this feature is not available in the normal version, you have to install the beta APK file.
- Use your phone and go the settings.
- Find the option "Security" (HTC) or "Lock screen and security" (Samsung). I am not sure how this option is called on other Android devices.
- Make sure that the option "Unknown sources" is enabled.
- Download the Plex beta app on your Android phone and install it.
- Open the Plex (beta) app. You will have to re-login to the app and it won't keep the settings from the normal Plex app.
- Go to "Settings" -> "Advanced" and select "Chromecast".
- Change Chromecast Application ID to "Custom".
- In the field "Custom Chromecast Application ID", enter your own Chromecast Application ID.
- Go back and connect to your Chromecast. You should now be able to cast videos using your own Chromecast App.
|
|
Recent Posts
|
About Swap
jonescelinaa Apr 10, 2024, 06:58 AM
|
Tracker Status: Error Connection Time Out
jonesPhedra Apr 04, 2024, 08:17 AM
|
Split Tunnel Docker Containers
jonesPhedra Mar 27, 2024, 03:10 AM
|
Plex server not powerful enough, but only with s...
jonesPhedra Mar 27, 2024, 03:02 AM
|
game Geometry Dash Scratch
jonescelinaa Jan 31, 2024, 04:21 AM
|
Latest unread posts | Unanswered posts |
|