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

Test pull request #17

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ See [LICENSE](LICENSE).

## Terms
Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/) and the [Google Cast SDK Additional Developer Terms of Service](https://developers.google.com/cast/docs/terms/).
## TODO
- new work
2 changes: 1 addition & 1 deletion css/receiver.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cast-media-player {
/* Sample Overlay Text */
/* ------------------------------------------------- */
cast-media-player:after {
content: "SAMPLE";
content: "Simple Joy";
position: absolute;
left: 0;
right: 0;
Expand Down
20 changes: 20 additions & 0 deletions js/receiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ import { CastQueue } from './queuing.js';
const context = cast.framework.CastReceiverContext.getInstance();
const playerManager = context.getPlayerManager();

// enable debug log
context.setLoggerLevel(cast.framework.LoggerLevel.DEBUG);
const castDebugLogger = cast.debug.CastDebugLogger.getInstance();

// Enable debug logger and show a warning on receiver
// NOTE: make sure it is disabled on production
castDebugLogger.setEnabled(true);

// Show debug overlay
castDebugLogger.showDebugLogs(true);

// Listen and log all Core Events.
playerManager.addEventListener(cast.framework.events.category.CORE,
event => {
console.log("Core event: " + event.type);
console.log(event);
castDebugLogger.info("ANALYTICS", event);
});

playerManager.addEventListener(
Expand All @@ -41,9 +53,16 @@ playerManager.addEventListener(
// Intercept the LOAD request to be able to read in a contentId and get data.
playerManager.setMessageInterceptor(
cast.framework.messages.MessageType.LOAD, loadRequestData => {
castDebugLogger.info('MyAPP.LOG', 'Intercepting LOAD request');
return loadRequestData;
});

// Set verbosity level for custom tags
castDebugLogger.loggerLevelByTags = {
'MyAPP.LOG': cast.framework.LoggerLevel.WARNING,
'ANALYTICS': cast.framework.LoggerLevel.INFO,
};

const playbackConfig = new cast.framework.PlaybackConfig();

// Set the player to start playback as soon as there are five seconds of
Expand Down Expand Up @@ -73,6 +92,7 @@ controls.assignButton(
)

context.start({
maxInactivity: 3600,
queue: new CastQueue(),
playbackConfig: playbackConfig,
supportedCommands: cast.framework.messages.Command.ALL_BASIC_MEDIA |
Expand Down
Loading