diff --git a/src/main/java/com/adobe/epubcheck/opf/XRefChecker.java b/src/main/java/com/adobe/epubcheck/opf/XRefChecker.java
index 63aa1853e..ca5b614a5 100755
--- a/src/main/java/com/adobe/epubcheck/opf/XRefChecker.java
+++ b/src/main/java/com/adobe/epubcheck/opf/XRefChecker.java
@@ -326,7 +326,17 @@ private void checkReference(Reference ref)
&& !(version == EPUBVersion.VERSION_3 && res != null && res.item.isInSpine())
// audio, video, and fonts can be remote resources in EPUB 3
&& !(version == EPUBVersion.VERSION_3
- && EnumSet.of(Type.AUDIO, Type.VIDEO, Type.FONT).contains(ref.type)))
+ && (res != null
+ // if the item is declared, check its mime type
+ && (OPFChecker30.isAudioType(res.item.getMimeType())
+ || OPFChecker30.isVideoType(res.item.getMimeType())
+ || OPFChecker30.isFontType(res.item.getMimeType()))
+ // else, check if the reference is a type allowing remote resources
+ || ref.type == Type.FONT
+ || ref.type == Type.AUDIO
+ || ref.type == Type.VIDEO
+ )
+ ))
{
report.message(MessageId.RSC_006,
EPUBLocation.create(ref.source, ref.lineNumber, ref.columnNumber, ref.refResource));
diff --git a/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/content_001.xhtml b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/content_001.xhtml
new file mode 100644
index 000000000..9a06ac276
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/content_001.xhtml
@@ -0,0 +1,11 @@
+
+
+
+
+ Minimal EPUB
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/nav.xhtml b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/nav.xhtml
new file mode 100644
index 000000000..240745e63
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/package.opf b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/package.opf
new file mode 100644
index 000000000..e8da45297
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/EPUB/package.opf
@@ -0,0 +1,17 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/META-INF/container.xml b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/mimetype b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-audio-object-valid/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/content_001.xhtml b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/content_001.xhtml
new file mode 100644
index 000000000..6c169d4a6
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/content_001.xhtml
@@ -0,0 +1,11 @@
+
+
+
+
+ Minimal EPUB
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/nav.xhtml b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/nav.xhtml
new file mode 100644
index 000000000..240745e63
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/package.opf b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/package.opf
new file mode 100644
index 000000000..6aa17f629
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/EPUB/package.opf
@@ -0,0 +1,17 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/META-INF/container.xml b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/mimetype b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/files/epub/resources-remote-video-object-valid/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/resources-publication.feature b/src/test/resources/epub3/resources-publication.feature
index eb15ffa3e..fae550157 100644
--- a/src/test/resources/epub3/resources-publication.feature
+++ b/src/test/resources/epub3/resources-publication.feature
@@ -108,6 +108,11 @@ Feature: EPUB 3 ▸ Publication Resources ▸ Full Publication Checks
When checking EPUB 'resources-remote-audio-valid'
Then no errors or warnings are reported
+ Scenario: Verify that remote audio resources are allowed anywhere
+ (not only in `audio` elements)
+ When checking EPUB 'resources-remote-audio-object-valid'
+ Then no errors or warnings are reported
+
Scenario: Verify that remote audio resources defined in the `sources` element are allowed
When checking EPUB 'resources-remote-audio-sources-valid'
Then no errors or warnings are reported
@@ -120,6 +125,11 @@ Feature: EPUB 3 ▸ Publication Resources ▸ Full Publication Checks
When checking EPUB 'resources-remote-video-valid'
Then no errors or warnings are reported
+ Scenario: Verify that remote video resources are allowed anywhere
+ (not only in `video` elements)
+ When checking EPUB 'resources-remote-audio-object-valid'
+ Then no errors or warnings are reported
+
Scenario: Report a reference to a remote resource from an `iframe` element when the resource is declared in the package document (issue 852)
When checking EPUB 'resources-remote-iframe-error'
Then error RSC-006 is reported