Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redo of 1.0.0 refactor pull request #57

Merged
merged 174 commits into from
Feb 24, 2020

Conversation

Lindsay-Needs-Sleep
Copy link
Collaborator

@dkanada @anthonylavado Sorry for the delay!! I have been (am) super busy with some urgent work.

Here is the pull request again!

(for reference, previous PR 54)

Sel-en-ium and others added 30 commits August 2, 2019 07:36
…tyle) (Will satisfy the eslint test in another commit.)
# Conflicts:
#	tests/tests.js
#	www/chrome.cast.js
…ork version. (Most tests fail. Will try to fix in another commit.)

# Conflicts:
#	README.md
#	tests/tests.js
…cess. (Chromecast.java)

We shouldn't prevent requestSession from going through if there is no receiver.  It handles this fine.  It just shows that it is searching for a chromecast.  This follows the behavior of chrome browser cast SDK. (chrome.cast.js)
Remove unused imports. (Chromecast.java)
Try to be a bit more safe with the threads. (Chromecast.java)
Just pass the Chromecast instance to the callback on initialization.  (Chromecast.java and ChromecastMediaRouterCallback.java)
…f power and annoying. Use the cordova log utility instead.
…n though.

Updated the README.md with instructions on how to run these tests.
We shouldn't load the tests.js file when the user is using the plugin for production use.
We shouldn't include the test framework as a dependency.  (Even a dependency of the test plugin.)
Added a pull_request_template.md
Managed to match the desktop chrome SDK behavior regarding receiver updates on start up.
Added some additional tests to cover more of the basic situations with receiver updates.
Simplified all the get route stuff (will fix it up properly later)
capture routeUnselected reason
…good stack trace. So remove them and check error as soon as possible to the criminal code.
…chrome desktop chromecast behavior. We are supposed to receive a callback to the error handler. Not have it silenced. This is important if you have started connection animations. If you never receive a callback you don't know when to stop the animations, and whether to transition back to the unconnected state or to a connected stated. If you wish to ignore the cancel error, just filter it out in your error callback. eg. if (err.code === 'cancel') { //ignore }
…pendencies is not great. Though, we are on our way to a monolith test this way. :/ Pick our poison I guess.
Session is automatically "rejoined" when the webview goes to a new page and calls initialize (this follows chromecast desktop sdk)
Do not call sessionListener on requestSession success (this does not follow chromecast sdk desktop behavior)
(So I changed all the tabs to spaces in the java files.  Sorry commit history. o.o)
It was a lot of work, so I disable a couple of the java checkstyle rules.  They are listed in the first comment in check_style.xml.
Issue jellyfin-archive#36 progress
…(because chrome broswer will not send receiver updates on the second call), also it is nice for the before to be simple since it is not meant to be testing initialize.
…the contentID to be set on media items (ios says it's deprecated), but without it, android counts ios loaded media messages to be malformed. Maybe Android needs to update the google cast library. Also removed some code duplication. Had 2 methods that were both building almost identical MediaInformation items.
… of using chromecast do not crash when this plugin is included
…Only set it for external loads that have more than 0 items.
…al) JSON parsing when creating a MediaInfo object
1) Ensure that we can get media updates after automatically rejoining a session after page reload and app restart (test_manual_primary_1.js) (second part of #5)
2) Ensure that you can't issue media control commands to an outdated media object after a new media object has been loaded (test_auto.js)

To fix #1: (chrome.cast.js) _currentMedia object was removed to ensure that we only send mediaUpdate events to the media stored in the session object.  All media object management is handle through the session object as well now.

To fix #2: (chrome.cast.js) we make sure to invalidate the media.mediaSessionId whenever new media is detected.  For chrome desktop, the new media will always have a different mediaSessionId, but for us, (on android at least), newly loaded media will have the same mediaSessionId, hence the invalidation of the previous media's mediaSessionId.  Additionally, in the case of new media, the old media object stored in session is removed and a new one added (instead of just updating like we were doing previously).
…ent item index is i, you load items [i-1, i, i+1] *exclude i-1 if it is < 0, and exclude i+1 if it is >= queue.length. (aka. don't wrap the items.) This is to match chrome desktop behavior.

Fixes a bug where larger queues (maybe 20+) result in a loop and queueLoad never returns.  This is also safer because it should not result in a crash due to eating all the memory for extremely large queues.
…alse for successfull preChecks (chrome.cast.js)
…vered this case was effectively skipped. So the test now works properly and you can control the media after an app restart.
…t before the client has received the session. (Can happen on occaision when resuming a session on page reload or app restart).
ios does not have mediaStatus on didResumeCastSession if initialize is called immediately after app restart.  So retry for 2 seconds to see if we can get any media.  If not, we will assume the session does not have any media loaded.
…array whenever media doesn't exist (instead of setting mediaSessionId to 'invalidated').
@anthonylavado anthonylavado merged commit 98edc9e into jellyfin-archive:master Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants